I am working on a repository in GitHub enterprise; I have created a 1.0.0
release for my project, mycoolrepo
.
How can I download the release zip artifact with curl or wget?
CodePudding user response:
From the documentation, you must hit:
/repos/{owner}/{repo}/tarball/{ref}
First of all, create a GitHub token with the necessary read permissions.
Then, if we say that:
- {owner} is
paolo
- {repo} is
mycoolrepo
- {ref} is
1.0.0
then you can use:
$ curl -s -L -H "Authorization: token INSERT_TOKEN_HERE" https://github.MY_ENTERPRISE_NAME.com/api/v3/repos/paolo/mycoolrepo/tarball/1.0.0 --output release_zip
obviously, replace INSERT_TOKEN_HERE
and MY_ENTERPRISE_NAME
with the token and the organisation name respectively.
You can confirm the download has been successful with file
; for a successful download, it should look as follows:
$ file release_zip
release_zip: gzip compressed data, from Unix, original size 51200