Git Clone Fails

Contents

Git clone fails with fatal unexpected and invalid messages. The git repository is over 1GB and there is a work-a-round that made it possible to finally clone the repository successfully.

Error

fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

Suggestions

Some sites suggested using SSH clone rather than http. That wasn’t an option. Another suggesting using git debugging to diagnose the problem. This wasn’t very helpful.

export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1

Resolution

Execute the following commands.

git clone --depth 1 YOUR-URL-TO-CLONE ./
git fetch --unshallow
git pull

After executing the previous commands, the clone was a success.

Source(s)

  • https://stackoverflow.com/questions/26286155/pull-large-repository-more-than-1gb-size-over-http-fail
  • https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/github-clone-with-ssh-keys
  • https://confluence.atlassian.com/bitbucketserverkb/git-clone-fails-fatal-the-remote-end-hung-up-unexpectedly-fatal-early-eof-fatal-index-pack-failed-779171803.html