0

There are already some questions with answers how to download the ZIP file of GitHub repositories, but they don't work if the repository is private.

I know it should work with wget somehow since it does work with curl:

curl -u <USER> -L -o <FILENAME> https://github.com/<USER>/<REPO>/archive/master.zip

The above line will ask for <USER>'s password, download the master branch ZIP file and save it as <FILENAME>. However, the wget equivalent doesn't work:

wget --user=<USER> --ask-password --output-document=<FILENAME> https://github.com/<USER>/<REPO>/archive/master.zip

Results in ERROR 404: Not Found.

  • Does adding --auth-no-challenge help? – wurtel Apr 29 at 9:02
  • Probably curl always sends the auth. However IMHO github is not behaving correctly by giving a 404 when not authenticated. – wurtel Apr 29 at 12:31
1

It seems that github.com is not behaving politely by saying that the resource does not exist when a non-authenticated GET request is made. Normally wget will first try requesting the resource without authentication, and retry with that authentication data when a 401 Not Authenticated error is given.

This can be worked around by passing --auth-no-challenge so that wget sends the authentication data the first time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.