Is there anyway to programmatically fetch a zipball of private github repo?


We got a necessity to fetch a zipball of a private repo. For public ones it’s pretty easy either through GitHub API or manually ( But what about private repos? Not exactly obvious how to do it even having oAuth token.


New Alternative

Because the given accepted answer does not work anymore, I thought I would explain how I was able to do it with the new changes in the github API.

The new Download Api Link

First, I found information about downloading the archive here:

Public Repo

If it’s a public repo then it is very easy… you can do:

curl -L > octokit.tar.gz

Private Repo

If it’s it is a private repo, you need to create an oAuth token by going to your settings and then selecting “Developer settings” / “Personal access tokens“.
I created a personal token.

Then using the instructions on the following page I found out how to get private repo that you have permission to:

Full Code

curl -H "Authorization: token ab499f3b..." \
-L > wut.tar.gz

Be sure to replace ab499f3b... with your actual token.

Answered By – roychri

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published