Git "RPC failed; curl 18 transfer closed" on Large Clones
The clone started successfully but the connection dropped partway through transferring the pack. Large repositories over a flaky or buffered link are the usual trigger, ending in early EOF or index-pack failed.
What this error means
A clone of a large repository gets some way through "Receiving objects" then dies with RPC failed; curl 18 transfer closed and early EOF / fetch-pack: unexpected disconnect. Small repos clone fine; the big one fails, often at a different percentage each time.
remote: Enumerating objects: 482931, done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
error: 7423 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: index-pack failedCommon causes
A large pack over an unstable connection
Transferring a multi-gigabyte pack over a network that drops or stalls causes the HTTP transfer to close before completing. The bigger the repo, the more likely a single blip aborts it.
A proxy or buffer truncating the response
An intermediary proxy with a small buffer or an aggressive idle timeout can cut off a long-running pack transfer, producing curl 18.
How to fix it
Shallow-clone to shrink the transfer
Most CI only needs the tip. A shallow clone transfers a fraction of the data and rarely hits the timeout.
git clone --depth 1 https://github.com/org/big-repo.gitRaise the HTTP buffer
A larger post buffer lets Git move bigger chunks before flushing, which helps with proxies that choke on long streams.
git config --global http.postBuffer 524288000 # 500 MBRetry, or fetch in stages
- Retry the clone - a transient disconnect often succeeds on the next attempt.
- Clone shallow, then deepen incrementally with
git fetch --deepen 100if you need more history. - Prefer the SSH remote if HTTPS proxies keep truncating the transfer.
How to prevent it
- Use shallow clones in CI unless full history is genuinely needed.
- Cache the repository or use a partial clone for very large monorepos.
- Raise
http.postBufferon runners that sit behind buffering proxies.