GitHub Api download zip or tarball link

You can wget your way out of the GitHub repo to get a tar file (archive): wget –no-check-certificate https://github.com/User/repo/archive/master.tar.gz # better, if the certificate authorities are present: wget https://github.com/User/repo/archive/master.tar.gz will get you a file named ‘master’ from the user ‘User”s repo ‘repo’. The updated V3 API url is: https://api.github.com/repos/User/repo/:archive_format/:ref # # two possibilities for fomat: … Read more

github search limit results

The Search API will return up to 1000 results per query (including pagination), as documented here: https://developer.github.com/v3/search/#about-the-search-api However, there’s a neat trick you could use to fetch more than 1000 results when executing a repository search. You could split up your search into segments, by the date when the repositories were created. For example, you … Read more

How to delete a GitHub repo using the API

If you created the token you’re using through the Applications page, then this token will have these scopes: user, public_repo, repo, gist. You can verify this by making an API request with that token and looking at the response HTTP headers: curl -v -H ‘Authorization: token xxx’ https://api.github.com Look for the X-OAuth-Scopes response header which … Read more

How to create a commit and push into repo with GitHub API v3?

Solution using the requests library: NOTES: I use the requests library to do the calls to GitHub REST API v3. 1. Get the last commit SHA of a specific branch # GET /repos/:owner/:repo/branches/:branch_name last_commit_sha = response.json()[‘commit’][‘sha’] 2. Create the blobs with the file’s content (encoding base64 or utf-8) # POST /repos/:owner/:repo/git/blobs # { # “content”: … Read more

Github API: Retrieve all commits for all branches for a repo

I have encountered the exact same problem. I did manage to acquire all the commits for all branches within a repository (probably not that efficient due to the API). Approach to retrieve all commits for all branches in a repository As you mentioned, first you gather all the branches: # https://api.github.com/repos/:user/:repo/branches https://api.github.com/repos/twitter/bootstrap/branches The key that … Read more