Reputation: 5691
I am trying to download as a zip file a private GitHub repo.
I am trying:
curl -H "Authorization: token f19..." -L https://github.com/Mylab/name/archive/release.zip
and it shows me:
{"error":"Not found"}
If I try:
curl -H "Authorization: token f19..." -L -o release.zip https://github.com/Mylab/name/archive/release.zip
it downloads a very small zip file which I can't open because it says "Either this file is not zip ......".
Upvotes: 4
Views: 1310
Reputation: 576
This should solve your problem
curl -H "Authorization: token f19..." -Lk https://api.github.com/repos/Mylab/name/zipball/release -o release.zip
EDIT : you need to customize :
EDIT 2: you need to have a token that have the whole "repo" category ticked to grant you full access to private repositories
EDIT 3: beware there must be only one space between token and f19...
Upvotes: 1
Reputation: 18865
The name after /archive/
has to be the name of the branch you want to download.
Usually it's master.zip
or feature/my-feature.zip
, release/my-release.zip
etc. Just release.zip
sounds suspicious as release/
is commonly only the prefix for the release branches in git.
So the correct URL/command are:
curl -H "Authorization: token f19..." -L https://github.com/Mylab/name/archive/master.zip
curl -H "Authorization: token f19..." -L https://github.com/Mylab/name/archive/feature/my-feature.zip
curl -H "Authorization: token f19..." -L https://github.com/Mylab/name/archive/release/august-release-001.zip
You can check the correct URL at the right on github, in the button Clone or download / Download ZIP when already chose correct branch from the list.
Upvotes: 0