How to download .zip from GitHub for a particular commit sha?

git, github

Solution

You can put the sha that you want in the download url:

`https://github.com/{username}/{projectname}/archive/{sha}.zip`

As a general rule, if you have a url that works, you can replace "master" with the specific sha you want.

On unix:

`wget https://github.com/{username}/{projectname}/archive/{sha}.zip`

Keep in mind that if this is a private repo then wget will not work unless you pass an OAuth token as well.

Here's more info on that:

Having trouble downloading Git archive tarballs from Private Repo

Problem

I want to download a .zip with the source of a library hosted on github, but I don't want the master, because every time I download I could be downloading a different version. This particular library does not have tags, so I can't use that. So how do I download the source.zip for a specific commit sha?

Original source

Related problems