Github tarball download

Github provides a feature of downloading entire repository from a single URL (a tarball). The downloaded repository file is combined into a single file using Linux tar command. The archive file is also compressed using gzip compression.

The tarball URL is as follows:<username>/<repository>/tarball/<version>

Where username is Github username, repository is a Github repository name and version can be either a git repository branch name or a tag name.

The repository tarball file can be downloaded using one of the popular tools like wget or curl. Let’s try to get Flake Id generator:

The file will contain a repository directory with name convention as follows:


Where username is a Github username, repository is a Github repository name and abbreviated-SHA-1-checksum is the latest commit in a specified branch or the specified tag commit abbreviated SHA-1 checksum.

Example: will contain a repository for tag v0.1.4, and the directory will be called T-PWK-flake-idgen-9273402.


To download the master version of the repository, use the following command.


If you want to extract repository directory bypassing file download, you can use -O - option (to have the file written to standard output) and pipe the output to tar xz command.

wget -O - | tar xz


Curl is very similar to wget in respect of a tarball file download. However, -L follow HTTP(S) redirects option must be used (wget follows HTTP(S) redirects by default) as the tarball files are served by slightly different URL.

curl -L > master

Alternatively, you can extract the repository directory straight from the input stream

curl -L | tar xz



You may also be interested in: