Skip to content
Source
Sign inSign up

Download a ZIP of the code

Code and repositories / Read code

Download a ZIP of the code

You want the files of a repository without git: to read them on a computer with no git, to hand them to a tool, or to keep a copy of one release. Download ZIP gives you every file of a branch, a tag or a commit as one ZIP or tar.gz file, with no git history.

3 min read

1. Open the branch, the tag or the commit

Open the repository. Its home page shows the default branch. To get another branch or a tag, pick it in the branch switcher above the files. To get a commit, open the files of that commit.

2. Open the Code menu

Click Code above the files, on the right.

The Code menu of a repository: the Clone tabs HTTPS and Source CLI, the button that copies a prompt for your agent, then Download ZIP and tar.gz for the branch main

3. Download the files

  • Click Download ZIP for a ZIP file.
  • Click tar.gz for a gzipped tar file.

The file is named after the repository and the ref: <repo>-<branch or tag>.zip, with each / of the name as -, or <repo>-<commit id>.zip for a commit. Every file of the archive is in one folder of the same name.

Done

You have every file of the branch, the tag or the commit that you opened, in one file.

What the archive has

  • Git makes the archive (git archive), so .gitattributes applies, as on GitHub. A file or a folder marked export-ignore is not in it, and a file marked export-subst has its $Format:...$ placeholders filled in.
  • A Git LFS file stays its pointer file: the archive has the small text file that git stores, not the large file.
  • A submodule is an empty folder.
  • An archive has no git history and no .git folder. To work on the code, clone the repository.

Download from a script or an agent

Each download is a link that you can use anywhere:

https://source.tanstack.com/@<owner>/<repo>/archive/<ref>.zip
https://source.tanstack.com/@<owner>/<repo>/archive/<ref>.tar.gz

<ref> is a branch or a tag, with or without refs/heads/ or refs/tags/ (and with slashes in its name), or a full or short commit id. The link of a private repository needs a token in the Authorization header, or your browser session, with read access.

From the src CLI:

src repo download
src repo download acme/app --ref v1.2.0 --format tar.gz
src repo download --ref main --output - | tar -tz

src repo download saves the file in the current folder under the name above. --output writes it to another path, and --output - writes it to stdout.

REST answers GET /api/v1/repos/{owner}/{repo}/zipball/{ref} and GET /api/v1/repos/{owner}/{repo}/tarball/{ref} with a redirect to the link, as GitHub does. Without {ref}, they give the default branch. The MCP tool get_archive_links gives both links of a ref.

Limits

  • Crawlers get no archive: /robots.txt closes them, and the crawler limits of the code pages apply.
  • A visitor who is not signed in counts toward the limit of such reads of the repository. Over it, the download answers 503 with the time to wait. Sign in to download.
  • The git servers make a limited number of archives at a time. When they are busy, the download answers 503: try again in a minute.
  • The archive of a full commit id never changes. The forge keeps a copy of a small archive of a public repository near you, so the next download of it starts at once.