Fixing Git Clone “Early EOFs” Fatal Error

The “git clone” command – as its name suggest – allows you to duplicate an entire repository from remote to local, or vice versa. Although it is a fairly simple and straight forward git command, sometimes, problems may still arise.

Earlier this week, I was hit with an error while executing git clone, and the error looks like the following:

error: pack-objects died of signal 9.20 MiB | 79.00 KiB/s      
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOFs:   1% (66/3818), 6.04 MiB | 53.00 KiB/s

After some researching and debugging, here are the two main causes of the fatal error.

1. Slow Internet connection

Cause of error

The repository is huge and Internet connection is simply too slow.

This came from my personal experience – I was attempting to clone a repository of about 1.5Gb. It kept failing at inconsistently at different rate of downloaded %, sometimes after 20Mb, sometimes after 60Mb, 200Mb, etc.

Solution

Changing to a faster and more stable Internet connection helps. With a faster connection, I was able to get closer to 1.5Gb. At one point I’m able to clone without any error.

2. Huge repository

Cause of error

The repository you are trying to clone is large, in terms of file size. While attempting to clone it, the remote server simply doesn’t have enough memory to cope with the execution.

Solution

Turn of compression. Git clone partially. When it is successful, clone the rest.

  1. First, turn off Git compression.

    git config --global core.compression 0
  2. Then do a partial clone of the repository with --depth 1 parameter. Replace username@domain.com/path/to/git_repo/ with the actual path to the repository.

    git clone —depth 1 ssh://username@domain.com/path/to/git_repo/
  3. Next, retrieve the rest of the repository.

    git fetch --unshallow
  4. Finally, finish it up with a regular pull.

    git fetch --unshallow

These methods solved my problem. Hope it helps!

FacebookTwitterInstagramPinterestLinkedInGoogle+YoutubeRedditDribbbleBehanceGithubCodePenEmail