Fix 'RPC failed' and 'the remote end hung up unexpectedly'
Cloning or pushing dies with 'RPC failed' or 'the remote end hung up unexpectedly' — how do I get it through?
If you’re seeing this error
error: RPC failed; curl 56 Recv failure: Connection was resetfetch-pack: unexpected disconnect while reading sideband packetfatal: the remote end hung up unexpectedlyerror: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanlyfatal: early EOFYou’re in the right place — the fix is below.
Short answer
The connection dropped part-way through a large transfer. Nothing is damaged. Clone shallow to make the transfer small enough to finish (git clone --depth 1), then deepen it with git fetch --unshallow. Switching the remote to SSH avoids the HTTP layer entirely and fixes most stubborn cases.
git clone --depth 1 <url>
cd <repo>
git fetch --unshallow
Get a working repository first, then fill in the history in resumable steps
Does this match your situation?
- 'error: RPC failed; curl 56 Recv failure: Connection was reset'
- 'fetch-pack: unexpected disconnect while reading sideband packet'
- 'fatal: the remote end hung up unexpectedly'
- 'fatal: early EOF' or 'index-pack failed'
- The clone reaches 40 or 80 percent and restarts or dies, repeatedly.
- Small repositories clone fine; one large one never completes.
Step-by-step fix
Clone shallow, then deepen
The transfer fails because it is one long-running stream. --depth 1 asks for the latest commit only, which is a fraction of the data and usually completes first time. Unshallowing afterwards is a separate request you can retry as often as you need without losing what you already have.
step 1git clone --depth 1 <url> cd <repo> git fetch --unshallow # still too big? deepen gradually: git fetch --depth 100 git fetch --depth 1000Switch to SSH
curl 56 and HTTP/2 stream errors come from the HTTP transport. SSH uses a different protocol and different infrastructure, and often succeeds immediately on a network where HTTPS keeps resetting.
step 2git clone git@github.com:user/repo.git # existing repository: git remote set-url origin git@github.com:user/repo.gitForce HTTP/1.1
A great many of these failures are HTTP/2 multiplexing problems introduced by a proxy, a VPN or an antivirus product that inspects traffic. Downgrading the protocol version is a one-line test that frequently resolves it outright.
step 3git config --global http.version HTTP/1.1 git clone <url>Raise the buffer for a large push
For pushes specifically, Git's 1 MB HTTP buffer can cause a single large object to be chunked awkwardly. Raising it helps on older Git and older servers; on modern versions it usually changes nothing, so try it after the steps above rather than first.
step 4git config --global http.postBuffer 524288000 # 500 MBWidely quoted as the fix for everything. It is not — treat it as a last resort for pushes, not the first thing to try.
Give a slow link more patience
Git aborts a transfer that falls below a minimum speed for a set time. On a genuinely slow connection those defaults cause failures that are nothing to do with the repository.
step 5git config --global http.lowSpeedLimit 0 git config --global http.lowSpeedTime 999999Resume rather than restart
A clone that failed mid-checkout may still have most of the objects. Re-running fetch in the partial repository continues from where it stopped, which beats deleting the folder and starting from zero.
step 6cd <partial-repo> git fetch --all git checkout main
Why this works
Git transfers history as a single packfile negotiated over one connection. The server computes it, streams it, and the client indexes it — and because that stream has to survive from beginning to end, anything that interrupts it discards the whole transfer rather than part of it. curl 56, early EOF and 'unexpected disconnect while reading sideband packet' are all the same event described from different layers: the stream stopped before the pack was complete. That is why every effective fix works by making the stream shorter or the path more reliable rather than by repairing anything. Shallow cloning asks for less data, SSH takes a different route, and HTTP/1.1 avoids the multiplexing layer that inspection proxies most often mangle.
If that didn’t work
- Try a different network — tethering to a phone rules the local link in or out in minutes.
- Disable antivirus HTTPS scanning temporarily; it terminates and re-establishes long connections.
- On a huge repository, git clone --filter=blob:none gives full history without file contents until needed.
- If the server itself is failing, ask an administrator to run git gc on it — an unpacked repository is slow to serve.
How to stop it happening again
- Use --filter=blob:none or --depth for large repositories you only need to build.
- Prefer SSH remotes on unreliable or heavily inspected networks.
- Keep binaries in Git LFS so packfiles stay small enough to transfer in one go.
- Push regularly — one push of six months' work is exactly what fails.
Commands used in this guide
git cloneCopy a remote repository, its full history and its branches, onto your machine.
git fetchDownload new commits from the remote without changing any of your files.
git configRead and write Git settings for one repo, your user, or the whole machine.
git remoteManage the named URLs your repository syncs with.
git repackRebuild the pack files that store your objects efficiently.
Still stuck?
Search the full command reference and every other rescue guide — there are 76 of them, covering everything from detached HEAD to force-push disasters.
Browse all guides →Frequently asked questions
What does 'RPC failed; curl 56' mean in Git?
The HTTP connection carrying the packfile was reset before the transfer finished. curl 56 is a receive failure, not a Git problem — the repository is fine and nothing is corrupted, the stream simply stopped early.
How do I clone a very large repository that keeps failing?
git clone --depth 1 <url> fetches only the latest commit, which usually completes, then git fetch --unshallow fills in the history as a separate retryable step. git clone --filter=blob:none is the modern alternative: full history, file contents fetched on demand.
Does increasing http.postBuffer fix this?
Sometimes, for pushes, on older Git and older servers. It is quoted far more often than it works, and on modern Git it usually makes no difference. Try shallow cloning, SSH and HTTP/1.1 first.
Why does 'unexpected disconnect while reading sideband packet' happen?
The sideband is the channel carrying progress messages alongside the packfile, so this is simply where the client noticed the connection died. It points at the network path — a proxy, VPN, antivirus or unstable link — rather than at anything in the repository.
Is my repository corrupted when this happens?
No. Git indexes the packfile only after receiving it whole, so an interrupted transfer leaves nothing half-applied. Retrying, or resuming with git fetch inside the partial clone, is completely safe.
Related rescue guides
Cloning takes forever — how do I clone a big repo faster?
Use --filter=blob:none for a partial clone that fetches file contents lazily, and add sparse-checkout to materialise only the directories you need. --depth 1 is fastest of all but gives you no usable history.
Read the fix →Always fixableGit says 'SSL certificate problem: unable to get local issuer certificate' — how do I fix it?
Something is intercepting your HTTPS traffic — nearly always a corporate inspection proxy such as Zscaler or Netskope — and Git does not trust the certificate it presents. The correct fix is to add your organisation's root CA to the bundle Git reads, via http.sslCAInfo. Do not turn verification off: sslVerify=false makes every push and pull interceptable by anyone.
Read the fix →Always fixableGit LFS is broken — my files are text pointers, or the clone dies with 'smudge filter lfs failed'
A smudge failure means Git downloaded the pointer files but could not fetch the real content. Clone with GIT_LFS_SKIP_SMUDGE=1 to get past it, run git lfs install to register the filters, then git lfs pull to fetch the actual bytes. If you are seeing a 130-byte text file where a binary should be, the pointer was never expanded — the content is safe on the server.
Read the fix →Usually recoverableGit says 'object file is empty' or 'loose object is corrupt' — can I repair it?
Corruption is almost always a few damaged object files after a crash, disk problem or a killed process. Run git fsck to identify them, delete the empty or unreadable ones, and re-fetch the good copies from your remote. If you have a remote, a fresh clone is often the fastest fix.
Read the fix →