Move from GitHub / Import
Push a large repository
git push failed because the push is too large. src repo push sends the same push in parts, so a push that is larger than one request gets in.
5 min read
Git sends a push as one request, and one request can carry at most 100 MiB by default. Git shows one of these errors:
error: remote unpack failed: error The push is larger than 100 MiB. Push fewer commits at a time (git push origin <commit>:refs/heads/<branch>), or use src repo push for a large repository, or Git LFS for big files.
error: remote unpack failed: error This push is 240 MiB, and this server takes at most 100 MiB in one push. Push it with src repo push, which sends a push in parts: src repo push origin <branch>.
error: RPC failed; HTTP 413
1. Log in with src
Install
src: see Install and set up the CLI.Log in:
src auth login
2. Push with src repo push
In your clone, push the branch as you do with git:
src repo push origin mainWait for the report. A large push can take some minutes, because Source checks the whole push with git before any branch moves. Then
srcprints the same lines asgit push:To https://source.tanstack.com/@acme/app.git * [new branch] main -> main
src repo push takes the remote and the refspecs of git push:
| You want to | Run |
|---|---|
| Push the current branch to the branch of the same name | src repo push |
| Push a branch and a tag | src repo push origin main v1.0.0 |
| Push a local branch to another remote branch | src repo push origin feature:refs/heads/release |
| Replace a remote branch that is not an ancestor of yours | src repo push --force origin main, or src repo push origin +main |
Without --force or a leading +, src refuses an update that is not a fast-forward, as git does. To delete a remote branch, use git push origin --delete <branch>.
Done
Your repository is on TanStack Source. After the first push, git push works for the usual small pushes. Use src repo push again when a push is too large for one request.
What src does for you
It sends only what Source does not have.
srcreads the branches and tags of the remote. Then it writes a pack of the missing objects into the.gitfolder of your clone. It deletes the pack when the push ends.It sends the pack in parts. Each part is smaller than the push request limit of the site. If the edge of Cloudflare refuses a part with HTTP 413,
srcstarts again with parts of half the size, down to 5 MiB:The forge refused a part of 7.00 MiB (HTTP 413). The push starts again with parts of 5.00 MiB.All branches and tags move together, or none moves. Source checks the push as it checks a
git push, with push protection and the rules of the branches. If a check refuses the push,srcprints the reason, and no branch moves:To https://source.tanstack.com/@acme/app.git ! [remote rejected] main -> main (push protection: config/.env looks like an environment file; keep secrets out of git. Remove the file from your commits (git rm --cached <file>, then git commit --amend, or git rebase -i for an older commit), then push again. Name a template .env.example. If the file holds no secrets, ask an admin to turn off Block environment files in the repository settings, under Push protection.) error: failed to push some refs to 'https://source.tanstack.com/@acme/app.git'It waits for a slow check. Source can take up to 10 minutes to check a large push. If the answer gets lost on the way,
srcreads the branches of the remote every 30 seconds, for up to 11 minutes. It reports the push when the branches moved:The forge can still land the push. src reads the remote refs every 30 seconds, for up to 11 minutes.
The limits of a push
Objects: one push can carry at most 1,000,000 objects by default. A site admin can change this limit: see Set the limits of the site.
Files: a file can be up to 128 MiB. Keep larger files in Git LFS.
Size of the repository: a push that adds data to a repository at its size limit is refused. See When a repository nears its size limit.
The git servers: every repository has its git on the git servers of the forge (see Set up the git servers), and
src repo pushlands there as agit pushdoes. The git servers check a large push in as many parts as it needs, so one large commit is fine. They refuse only a push that they cannot check, withThis push is too large for TanStack Source to check on its git servers:- A push with more than about 500,000 new commits.
- A push whose parts take more than 11 minutes to check.
- A commit whose own text (its message and headers) is more than 16 MiB.
If you get this message, push fewer commits at a time, oldest first, as in Push a long history in parts. If one commit has a message of more than 16 MiB, make the message shorter.
Push a long history in parts
If a history has more objects than one push can carry, push it in two or more pushes, oldest first:
Find a commit about halfway through the history, for example with
git log --oneline main.Push that commit to the branch:
src repo push origin <older-commit>:refs/heads/mainPush the rest:
src repo push origin main
If git push fails for another reason
Git prints the reason of the forge. Each reason says what to do next:
non-fast-forward updates to the default branch are blocked. Get the new commits first (git pull --rebase), then push again.: the default branch has commits that you do not have. Rungit pull --rebase, then push again.push protection: ...: the push holds a secret or an environment file. See Keep secrets out of the repository.remote: This token does not allow contents:write: the token cannot push. Make a token that can: see Make an access token.remote: You need write access to acme/app to do that: ask an admin of the repository for write access.