Skip to content
Latchkey

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.

git clone output
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 failed

Common 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.

Terminal
git clone --depth 1 https://github.com/org/big-repo.git

Raise the HTTP buffer

A larger post buffer lets Git move bigger chunks before flushing, which helps with proxies that choke on long streams.

Terminal
git config --global http.postBuffer 524288000   # 500 MB

Retry, or fetch in stages

  1. Retry the clone - a transient disconnect often succeeds on the next attempt.
  2. Clone shallow, then deepen incrementally with git fetch --deepen 100 if you need more history.
  3. 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.postBuffer on runners that sit behind buffering proxies.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →