George George - 1 year ago 93
Git Question

Download repo as a zip file

I am trying to download as a zip file a private GitHub repo.

I am trying:

curl -H "Authorization: token f19..." -L

and it shows me:

{"error":"Not found"}

If I try:

curl -H "Authorization: token f19..." -L -o

it downloads a very small zip file which I can't open because it says "Either this file is not zip ......".

Answer Source

This should solve your problem

curl -H "Authorization: token f19..." -Lk -o 

EDIT : you need to customize :

  • Mylab : user or organization
  • name : repository name
  • release : tag or branch targeted

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...