You can download a snapshot of any branch, tag, or specific commit from GitHub.com. These snapshots are generated by the git archive
command in one of two formats: tarball or zipball. Snapshots don't contain the entire repository history. If you want the entire history, you can clone the repository. For more information, see "Cloning a repository."
You can download the source code archives in three ways.
On GitHub.com, navigate to the main page of the repository.
Above the list of files, click Code.
Click Download ZIP.
On GitHub.com, navigate to the main page of the repository.
To the right of the list of files, click Releases.
Scroll down to the "Assets" section of the release.
To download the source code, click Source code (zip) or Source code (tar.gz).
On GitHub.com, navigate to the main page of the repository.
To the right of the list of files, click Releases.
At the top of the Releases page, click Tags.
To download the source code, click zip or tar.gz.
Source code archives are available at specific URLs for each repository. For example, consider the repository github/codeql
. There are different URLs for downloading a branch, a tag, or a specific commit ID.
Note: You can use either .zip
or .tar.gz
in the URLs above to request a zipball or tarball respectively.
Source code archives are generated on request, cached for a while, and then deleted. If the same archive is requested again in the future, it'll be regenerated. It's important to understand what guarantees GitHub makes about source code archives.
If you rely on stability of source code archives for reproducibility (ensuring you always get identical files inside the archive), we recommend using the archives REST API with a commit ID for :ref
. Using the commit ID ensures you'll always get the same file contents inside the archive and you’ll be immune to repositories rewriting tags or moving branch heads.
If you rely on stability of archives for security (for example: to ensure you don't attempt to unzip a maliciously-crafted file), we recommend using releases instead of using source downloads. For more information, see "About releases."
You can use something like this third-party GitHub action to create and push these files as part of your release process. The Release Assets REST API can later be used to retrieve them.
GitHub.com is home to millions of open-source software projects, that you can copy, customize, and use for your own purposes.
There are different ways to get a copy of a repository's files on GitHub. You can:
Each of these methods has its own use case, which we'll explain in the next section.
This tutorial focuses on downloading a repository's files to your local computer. For example, if you've found some interesting content in a repository on GitHub, downloading is a simple way to get a copy of the content, without using Git or applying version control.
TermDefinitionUse caseDownloadTo save a snapshot of a repository's files to your local computer.You want to use or customize the content of the files, but you're not interested in applying version control.CloneTo make a full copy of a repository's data, including all versions of every file and folder.You want to work on a full copy of the repository on your local computer, using Git to track and manage your changes. You likely intend to sync these locally-made changes with the GitHub-hosted repository. For more information, see "Cloning a repository."ForkTo create a new repository on GitHub, linked to your personal account, that shares code and visibility settings with the original ("upstream") repository.You want to use the original repository's data as a basis for your own project on GitHub. Or, you want to use the fork to propose changes to the original ("upstream") repository. After forking the repository, you still might want to clone the repository, so that you can work on the changes on your local computer. For more information, see "Fork a repository."For the tutorial, we'll use a demo repository (octocat/Spoon-Knife).
Navigate to octocat/Spoon-Knife.
Above the list of files, click Code.
Click Download ZIP.
You now have a copy of the repository's files saved as a zip file on your local computer. You can edit and customize the files for your own purposes.