What git's HTTP 408 / curl 22 push error means, why raising http.postBuffer rarely helps, and the fixes that do: smaller pushes, SSH, Git LFS.
If git push stops with error: RPC failed; HTTP 408 curl 22 The requested URL returned error: 408, the server stopped waiting for your upload and closed the connection before it finished. Nothing is wrong with your commits. The upload took too long or stalled. In practice it usually comes down to one of three causes: the push is too big, the network is too slow or unstable, or the host is having a bad moment. The fixes, roughly in order: retry on a better connection, push less at once, take large files out of the push, or switch the remote from HTTPS to SSH. Raising http.postBuffer, the usual first suggestion, is rarely the fix. Git's own documentation says why.
What each part of the message means
The error stacks three layers, and only one of them tells you anything new.
- HTTP 408 Request Timeout. The server decided to close the connection rather than keep waiting. MDN notes that a server sending 408 should also send Connection: close, because the 408 means it has given up on the connection.
- curl 22. Git talks HTTP through libcurl. In curl's list of exit codes, 22 means the server returned an HTTP status of 400 or above. It is curl passing on the 408, not a second problem.
- RPC failed. Git's smart HTTP transport sends your pack as a POST request. That request is what failed.
Lines that often follow, such as send-pack: unexpected disconnect while reading sideband packet or fatal: the remote end hung up unexpectedly, are git reporting that the connection dropped partway through. They describe the same event. So the real question is: why did this upload run long enough, or stall long enough, for the server to give up?
Diagnose it in two minutes
Run these before you change any settings. Each one rules a cause in or out.
1. How much are you pushing? List the largest files in commits that no remote has yet:
git rev-list --objects HEAD --not --remotes \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| awk '$1 == "blob"' | sort -k3 -n | tail -10The third column is the size in bytes. git count-objects -vH shows the size of the whole repository's packs (size-pack). If one file is tens of megabytes, or the new history adds up to hundreds, size is your likely cause.
2. Is it the network? Try git fetch. If small requests work but the push fails every time at roughly the same point, size is more likely than the connection. If the failure point moves around, or a speed test on the same connection is poor, suspect the network. A VPN or office network adds another hop that can drop a slow upload, so try without it if you can.
3. Is it GitHub? Check the Git Operations row on githubstatus.com. If it shows an incident, wait. Nothing local will fix it.
4. Still unclear? Rerun the push with tracing on:
GIT_TRACE_CURL=1 GIT_TRACE_CURL_NO_DATA=1 git pushGIT_TRACE_CURL dumps the HTTP exchange, and GIT_TRACE_CURL_NO_DATA keeps it to headers and info lines so the pack data does not flood your terminal. You will see how long the request ran before the 408 came back.
- What you found — Likely cause — Go to
- A large file, or hundreds of MB of new history — Push size — Fixes 2 and 3
- Small push, failure point moves around — Network — Fixes 1 and 4
- Incident on githubstatus.com — Host side — Wait and retry
- Fails only on HTTPS, every time — HTTP path (proxy, VPN, network) — Fix 4
Fixes that work, in order
1. Retry on a better connection
Because a 408 is a timeout, a wired connection or a different network is the cheapest thing to try. If a fresh retry on a fast, stable connection goes through, you are done. If it fails at the same point again, the push is probably the problem.
2. Push less at once
You do not have to send all your new history in one request. Push an older commit first, then the rest:
git log --oneline --reverse origin/main..HEAD # unpushed commits, oldest first
git push origin <older-commit-sha>:refs/heads/main
git push origin mainEach push then carries only part of the history. For very large repositories, GitHub documents the same approach for its 2 GiB single-push limit, including a short loop that pushes every 1,000th commit.
3. Take large files out of the push
GitHub warns about files over 50 MiB and blocks files over 100 MiB. To track files beyond that limit you must use Git LFS; for smaller large files, consider keeping them out of the repository.
If the large file is only in commits you have not pushed yet, remove it before pushing. For the last commit:
git rm --cached path/to/bigfile
echo "path/to/bigfile" >> .gitignore
git add .gitignore
git commit --amendIf it sits in an older unpushed commit, git reset --soft origin/main turns all your unpushed commits back into staged changes. Unstage the file with git rm --cached, then commit again. If the file is already in pushed history, GitHub's guide covers git lfs migrate and git filter-repo. Both rewrite history, so agree on it with anyone else who uses the repository.
4. Switch the remote to SSH
The SSH transport does not use HTTP, so an HTTP 408 cannot happen. A bad connection can still break the push, but in a different way. With an SSH key added to your GitHub account:
ssh -T git@github.com
git remote set-url origin git@github.com:OWNER/REPO.git
git pushA working key answers with "Hi USERNAME! You've successfully authenticated". If your network blocks port 22, GitHub also accepts SSH over port 443 at ssh.github.com. Test it with ssh -T -p 443 git@ssh.github.com, then add this to ~/.ssh/config:
Host github.com
Hostname ssh.github.com
Port 443
User gitWhat about http.postBuffer?
git config http.postBuffer 524288000 is the fix you will see suggested most often. Here is what the setting does, according to git's documentation. When a push is larger than the buffer (1 MiB by default), git sends it with chunked transfer encoding. Raising the buffer only turns chunked encoding off. The docs say it should be used only when the server or a proxy supports nothing newer than HTTP/1.0 or does not follow the HTTP standard, and that raising it "is not, in general, an effective solution for most push problems". It also costs memory, because git allocates the whole buffer even for small pushes.
If you want to rule it out, try it for one push instead of setting it globally:
git -c http.postBuffer=524288000 pushIf that push succeeds, something in your HTTP path may not handle chunked uploads well, and switching to SSH is a cleaner long-term fix. If it fails the same way, go back to size and network.
If this happens in a live coding interview or a take-home walkthrough
Don't turn the interview into a git debugging session. Say what happened in one sentence: "My push timed out, so I'll show you the code locally and push it after the call." Then carry on: share your editor, or paste the code into the interview's own environment. Interviewers usually care most about how you approach the problem, so a quick, calm workaround helps you get back to that.
The better fix is to keep it from happening. Push the repository the day before. Clone it fresh into another folder to check that everything arrived. Make sure no build output or datasets slipped into the commits. If the interview includes live coding, our technical round interview questions and LeetCode interview questions cover what usually comes up. During the coding round itself, Verve AI's Coding Copilot captures a coding question from your screen and returns a solution in 21+ programming languages.
Sources
- HTTP 408 means the server closed the connection; it should send Connection: close: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/408
- curl exit code 22 (HTTP status of 400 or above): https://curl.se/docs/manpage.html
- http.postBuffer behaviour, 1 MiB default, "not, in general, an effective solution", memory cost: https://git-scm.com/docs/git-config
- GIT_TRACE_CURL and GIT_TRACE_CURL_NO_DATA: https://git-scm.com/docs/git
- git cat-file --batch-check format atoms (objecttype, objectname, objectsize, rest): https://git-scm.com/docs/git-cat-file
- git count-objects size-pack and -H: https://git-scm.com/docs/git-count-objects
- git remote set-url: https://git-scm.com/docs/git-remote
- GitHub 2 GiB single-push limit, splitting a push, "remote end hung up unexpectedly": https://docs.github.com/en/get-started/using-git/troubleshooting-the-2-gb-push-limit
- 50 MiB warning, 100 MiB block, Git LFS: https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-large-files-on-github
- git lfs migrate and filter-repo for files already in history: https://docs.github.com/en/repositories/working-with-files/managing-large-files/moving-a-file-in-your-repository-to-git-large-file-storage
- Testing an SSH connection, success message: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/testing-your-ssh-connection
- SSH over port 443 at ssh.github.com, config snippet: https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port
- Git Operations status component: https://www.githubstatus.com/
- Coding Copilot (captures the question from the screen, 21+ languages): .claude/skills/seo-rewrite/references/facts.md; https://docs.vervecopilot.com/features/coding-copilot
Ryan
CEO of Verve AI








