Why does git push to GitLab fail with "RPC failed" or "remote end hung up"?
Short answer
Git prints "error: RPC failed" and "fatal: the remote end hung up unexpectedly" when the connection to GitLab drops in the middle of a push, before GitLab has accepted it. The usual causes are a push too big for one request (GitLab.com caps a push at 5 GiB), a slow or unstable connection, an HTTP/2 stream reset (curl 92) or an idle SSH connection. Push in smaller batches, try git config http.version HTTP/1.1, add SSH keepalives and move large files to Git LFS; raising http.postBuffer helps only in narrow cases.
You push to GitLab. Git counts objects, compresses them, starts writing, and then gives up:
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: INTERNAL_ERROR (err 2)
fatal: the remote end hung up unexpectedly
Over SSH it reads differently:
Write failed: Broken pipe
fatal: The remote end hung up unexpectedly
These lines come from Git, curl or ssh on your computer, not from GitLab: the connection closed before the push finished. GitLab never accepted the push, so the branch wasn’t moved and a retry is safe, once you fix whatever closed the connection. Here’s what does, and the fixes in the order worth trying, with GitLab 19.6.
What does “RPC failed” mean?
Git talks to GitLab over HTTPS or SSH, and a push is one long upload of a pack of objects. “RPC failed” means that HTTPS request failed partway; “the remote end hung up unexpectedly” means the other side of the connection went away. The line just above usually names the real cause:
| Message | Comes from | Usual cause |
|---|---|---|
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: INTERNAL_ERROR (err 2) |
curl, over HTTPS | An HTTP/2 stream reset, often on a slow connection |
Write failed: Broken pipe |
ssh | The connection dropped mid-push: a network drop or an idle timeout |
fatal: pack has bad object at offset XXXXXXXXX: inflate returned -5 |
Git, on a large HTTPS push | The pack was cut off in transit |
remote: Calculating new repository size... (canceled after 729ms) and similar timings |
GitLab | GitLab’s own checks on the push ran past the time limit |
error: RPC failed; curl 18 transfer closed with outstanding read data remaining |
curl, on clone or fetch | A large download was cut off |
Is the push too big?
Check first, because no network tweak gets a push past a size limit. GitLab’s limits:
| Limit | GitLab.com | GitLab Self-Managed |
|---|---|---|
| One push | 5 GiB (git push requests through Cloudflare are capped at 5 GiB each) |
Maximum push size (MiB), set by an administrator in Admin > Settings > General > Account and limit |
| Repository, including LFS | 10 GiB on Free, 500 GiB on Premium and Ultimate | Size limit per repository (MiB), or a per-group or per-project Repository size limit (MiB); 0 means no limit |
A first push of a big, old repository is the classic case. See how much Git has to send:
git count-objects -vH
size-pack is roughly what a first push uploads. If it’s large, push the history in batches, oldest commits first, so each request stays small:
git push origin HEAD~2000:refs/heads/main
git push origin HEAD~1000:refs/heads/main
git push origin main
Each push fast-forwards the branch on GitLab, so pick steps that keep every batch comfortably small, and push other branches and tags afterwards.
Move large files to Git LFS
If the size comes from binaries such as builds, media or datasets, put them in Git LFS. git lfs install adds a pre-push hook and a .gitattributes file in the repository; then track the file types:
git lfs install
git lfs track "*.zip"
git add .gitattributes
Tracking applies to new commits. Files already in history stay there until you rewrite it with git lfs migrate, which rewrites the commits that contain them and changes their IDs, so do it before anyone else clones the project. LFS objects still count toward the repository size limit on GitLab.com.
If the project on GitLab is already too big, its size is under Settings > Usage quotas > Storage, in the Repository row. An Owner can remove large blobs from history in Settings > Repository > Repository maintenance > Remove blobs, then run Run housekeeping and Prune unreachable objects from Settings > General > Advanced.
Is it the connection?
When the push isn’t near a limit, the connection is the suspect.
Force HTTP/1.1. For the curl 92 error, GitLab’s docs suggest dropping HTTP/2 for this repository:
git config http.version HTTP/1.1
Keep SSH connections alive. For Broken pipe over SSH, add keepalives for your GitLab host to ~/.ssh/config (on PuTTY, set the keepalive to 60 seconds):
Host gitlab.com
ServerAliveInterval 60
ServerAliveCountMax 5
Try another network. GitLab’s docs suggest a different network, such as a phone’s hotspot, to rule out a local firewall, proxy or ISP. Switching transport helps for the same reason: push over SSH if HTTPS keeps failing, or the other way round.
Does raising http.postBuffer help?
It’s the most common answer online, and the least reliable. GitLab’s troubleshooting docs suggest it for broken-pipe errors and for the inflate returned -5 error, raising the default of 1 MB to about 500 MB:
git config http.postBuffer 524288000
Git’s own documentation is more cautious. Pushes larger than the buffer are sent with chunked transfer encoding; raising the buffer only turns that off, which matters when a server or proxy in between speaks only HTTP/1.0 or mishandles chunked requests. It isn’t a fix for most push problems, and Git allocates the whole buffer even for a small push. If you try it, set it per repository as above, not with --global, and remove it once the push is through:
git config --unset http.postBuffer
Other fixes
- Repack. If the output mentions
pack-objectserrors, rungit repackand push again. - Update Git. GitLab’s docs flag versions older than 2.9.
- Trace the push.
GIT_TRACE_PACKET=1 GIT_TRACE=2 GIT_CURL_VERBOSE=1 git pushshows where the HTTPS transfer stops, andGIT_SSH_COMMAND="ssh -vvv" git pushdoes the same over SSH.GIT_CURL_VERBOSEcan print credentials, so check the output before you share it. - On GitLab Self-Managed, an administrator can raise
http.postBufferfor Gitaly ingitlab.rb, or setClientAliveInterval 60andClientAliveCountMax 5in the server’ssshd_config; one side’s keepalive is enough.
When a clone or fetch fails the same way
The download direction has its own version, error: RPC failed; curl 18 transfer closed with outstanding read data remaining, followed by fatal: early EOF and fatal: index-pack failed. Many files, a long history or large files are the usual reasons. A shallow clone gets you working, though it doesn’t make the repository smaller:
git clone --depth 1 https://gitlab.com/mygroup/my-project.git
In CI, the equivalent is GIT_DEPTH; see GitLab CI shallow clone errors.
When GitLab answers and says no
If the connection holds and GitLab refuses the push, the error is different and names the reason:
! [rejected] … (fetch first): GitLab’s branch has commits you don’t; see Git push to GitLab rejected (fetch first).! [remote rejected] … (pre-receive hook declined): a push rule, a protected branch or a size check; see GitLab “pre-receive hook declined”.HTTP Basic: Access deniedorPermission denied (publickey): Git couldn’t sign in; see HTTP Basic: Access denied or Permission denied (publickey).
On your phone
MergeBell doesn’t run Git on your phone, so a failed push gets fixed at your computer. Once the push lands, MergeBell shows the merge request and its pipeline, with the job log, retry and cancel, on the free tier. See how to review a GitLab merge request on your phone.
Frequently asked questions
Does increasing http.postBuffer fix "RPC failed" on git push?
Sometimes, and less often than forum answers suggest. GitLab's troubleshooting docs suggest git config http.postBuffer 524288000 for broken-pipe errors, but Git's own documentation says a bigger buffer only turns off chunked transfer encoding, helps only with servers or proxies that can't handle it, and allocates the whole buffer even for small pushes. Try HTTP/1.1 and smaller pushes first, and set it per repository, not globally.
What is the maximum push size on GitLab.com?
5 GiB. GitLab.com lists a maximum push size of 5 GiB, and git push requests through Cloudflare are limited to 5 GiB each. The repository itself, including LFS, is limited to 10 GiB on Free and 500 GiB on Premium and Ultimate. On GitLab Self-Managed, an administrator sets Maximum push size (MiB) in Admin > Settings > General > Account and limit.
How do I push a very large repository to GitLab?
Push it in batches of older commits first, for example git push origin HEAD~2000:refs/heads/main, then HEAD~1000, then the branch itself, so each request stays small. Move large binary files to Git LFS before pushing, because they count against the push and repository size limits either way.
What does "curl 92 HTTP/2 stream 0 was not closed cleanly" mean?
The HTTP/2 connection carrying your push was reset before the transfer finished. GitLab's docs link it to slow connections over HTTP and suggest git config http.version HTTP/1.1, a smaller http.postBuffer of 52428800, or trying another network.
Is it safe to run git push again after "the remote end hung up unexpectedly"?
Yes. The push didn't complete, so the branch on GitLab wasn't moved, and the next git push sends what's missing. Fix the cause first, or the retry fails the same way.
Sources
- GitLab docs — Troubleshooting Git (broken pipe, curl 92, curl 18, timeouts)
- GitLab docs — GitLab.com settings (maximum push size, repository size)
- GitLab docs — Account and limit settings (Self-Managed push and repository limits)
- GitLab docs — Git Large File Storage (LFS)
- GitLab docs — Repository size
- Git documentation — git config: http.postBuffer and http.version
Checked against these pages on 19 November 2026. GitLab changes quickly — if something here no longer matches, tell us and we will fix it.
Do this from your phone with MergeBell
Free for the whole review loop: the To-Do inbox, diffs and line comments, approve and merge, pipelines with retry, and push alerts for your To-Dos. Works with gitlab.com and self-managed GitLab 16.0+.
Get MergeBell for iPhoneGet MergeBell for Android
On the App Store for iOS 26 or later and on Google Play for Android 12 or later. An independent app, not affiliated with GitLab Inc.