# Git "RPC failed; curl 18 transfer closed" on Large Clones

> Fix Git "RPC failed; curl 18 transfer closed with outstanding read data" / "early EOF" on big clones in CI - raise http.postBuffer or use a shallow clone.

Source: https://latchkey.dev/learn/git/git-clone-rpc-failed-curl-error  
Updated: 2026-06-25

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

## Diagnose it: depth, refs, or credentials?

CI checkouts are shallow and detached by default, which breaks anything that needs history or a branch name. Before treating it as a credential problem, confirm what the runner actually fetched.

```.github/workflows/ci.yml
- run: |
    git rev-parse --is-shallow-repository
    git rev-parse --abbrev-ref HEAD      # prints HEAD when detached
    git log --oneline -3
    git remote -v
    git for-each-ref --format="%(refname)" | head
```

> `actions/checkout` fetches depth 1 and leaves you on a detached HEAD. Anything diffing against a base ref, reading the branch name, or running `git describe` needs `fetch-depth: 0` and usually an explicit ref.

## The checkout options that fix most of this

```.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0        # full history: diffs, tags, git describe
    submodules: recursive # submodules are NOT fetched by default
    persist-credentials: false  # if a later step pushes with its own token
```

## FAQ

### What causes Git "RPC failed; curl 18 transfer closed" on large clones?

There are 2 common causes: a large pack over an unstable connection and a proxy or buffer truncating the response. Transferring a multi-gigabyte pack over a network that drops or stalls causes the HTTP transfer to close before completing.

### How do I fix Git "RPC failed; curl 18 transfer closed" on large clones?

There are 3 fixes depending on which cause you have: shallow-clone to shrink the transfer, raise the http buffer, and retry, or fetch in stages. Work through them in order, since the first is the most common.

### What does Git "RPC failed; curl 18 transfer closed" on large clones actually mean?

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.

### How do I stop Git "RPC failed; curl 18 transfer closed" on large clones happening again?

Use shallow clones in CI unless full history is genuinely needed. The prevention section lists 3 changes that keep it from recurring.

### Can Latchkey fix this automatically?

Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
