Mengatasi Error Pada Git - fatal early EOF, fatal index-pack failed

Git Error

Kemarin saya sempat dibuat kesal karena error saat melakukan cloning repository dari remote server menggunakan SSH. Biasanya saya menggunakan protokol HTTPS, tetapi karena ingin lebih praktis, saya ubah semua remote URL menjadi SSH.

Sayangnya, saat proses cloning berlangsung, muncul error seperti berikut:

Git Error Screenshot

git clone git@bitbucket.org:emsuryadi/repository.git repo
Cloning into 'repo'...
remote: Counting objects: 638, done.
remote: Compressing objects: 100% (544/544), done.
Connection to bitbucket.org closed by remote host.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

Penyebab

Masalah ini terjadi karena adanya batasan memori atau proses kompresi Git yang tidak berjalan mulus saat transfer data, terutama untuk repository besar.


Solusi

1. Matikan Kompresi Git

Linux
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
git config --global core.compression 0
Windows
set GIT_TRACE_PACKET=1
set GIT_TRACE=1
set GIT_CURL_VERBOSE=1
git config --global core.compression 0

2. Gunakan Clone Parsial

git clone --depth 1 git@bitbucket.org:emsuryadi/repository.git repo

Masuk ke direktori hasil clone dan lanjutkan:

cd repo
git fetch --unshallow

Atau alternatif lain:

git fetch --depth=2147483647

3. Lanjutkan dengan Git Pull

git pull --all

Referensi

  1. Stack Overflow - fatal: early EOF
  2. Bitbucket Issue Tracker

Posting Komentar