Skip to content
Latchkey

Git "fatal: early EOF" / "index-pack failed" on Clone in CI

Git received fewer bytes than the pack header promised, so it could not finish building the index. The transfer was cut short - a large repo over a flaky or buffered link is the usual trigger.

What this error means

A clone gets some way through "Receiving objects" then aborts with fatal: early EOF followed by fatal: index-pack failed. It often fails at a different percentage on each attempt, which points at a transport drop rather than a corrupt repo.

git clone output
remote: Compressing objects: 100% (84211/84211), done.
remote: Total 482931 (delta 0), reused 482931 (delta 0)
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: 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

Common causes

A large pack over an unstable connection

Transferring a big pack over a network that stalls or drops cuts the stream before all objects arrive, so index-pack cannot complete.

A proxy with a small buffer or idle timeout

An intermediary that truncates long responses or times out idle streams ends the transfer early, producing the EOF.

How to fix it

Shallow-clone to shrink the transfer

A shallow clone moves a fraction of the data and rarely hits the cutoff.

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

Raise the buffer and retry

A larger post buffer helps with truncating proxies, and a bounded retry absorbs transient drops.

Terminal
git config --global http.postBuffer 524288000   # 500 MB
for i in 1 2 3; do
  git clone https://github.com/org/big-repo.git && break
  sleep 5
done

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

How to prevent it

  • Use shallow clones in CI unless full history is genuinely needed.
  • Raise http.postBuffer on runners behind buffering proxies.
  • Cache or mirror very large repositories instead of full-cloning each run.

Frequently asked questions

What causes Git "fatal: early EOF" / "index-pack failed" on clone in CI?
There are 2 common causes: a large pack over an unstable connection and a proxy with a small buffer or idle timeout. Transferring a big pack over a network that stalls or drops cuts the stream before all objects arrive, so index-pack cannot complete.
How do I fix Git "fatal: early EOF" / "index-pack failed" on clone in CI?
There are 2 fixes depending on which cause you have: shallow-clone to shrink the transfer and raise the buffer and retry. Work through them in order, since the first is the most common.
What does Git "fatal: early EOF" / "index-pack failed" on clone in CI actually mean?
A clone gets some way through "Receiving objects" then aborts with fatal: early EOF followed by fatal: index-pack failed.
How do I stop Git "fatal: early EOF" / "index-pack failed" on clone in CI 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.

Related guides

References

This is a transient network failure, not a bug in your code. Latchkey detects, repairs, and retries it for you. Start free → 30-day trial · No credit card