Corrupted repository on GitLab server


I’m using an on-premisse GitLab installation version 12.2.1 (fa2d61ef521) and one specific repository seems to be corrupted. Running ‘git clone’ or ‘git pull’ on it from remote results on the following error:

Cloning into ‘checkbook’…
Server supports multi_ack_detailed
Server supports side-band-64k
Server supports ofs-delta
Server version is git/2.22.0
want ae46a6458a63d028b688ecc3a05b86ff4196d8ee (HEAD)
want fddb1edf132b0e18209a3d0a1f241de2ad25137f (refs/heads/MF-893)
want ae46a6458a63d028b688ecc3a05b86ff4196d8ee (refs/heads/master)
want 590af57f0c568336fb22ff38f6ba827f0353e466 (refs/tags/1.0.0)
want aeb12dbfb3d987174b382abbff857c788d233d4e (refs/tags/1.0.0-RC-1)
remote: Enumerating objects: 440, done.
remote: Counting objects: 100% (440/440), done.
remote: Compressing objects: 100% (213/213), done.
error: git upload-pack: git-pack-objects died with error.\nfatal: git upload-pack: aborting due to possible repository corruption on the remote side.Rremote: fatal: unable to read 159828e44b9ee2b4940da5398c75d6353a6f1532
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOFs: 96% (2898/3018)
fatal: index-pack failed

How I can workaround on this issue?


I just found the solution.

First I needed to run fsck on my repo at server side to check what file was missing:

$ git fsck

Checking object directories: 100% (256/256), done.
Checking objects: 100% (2960/2960), done.
broken link from tree 6e8155b60cc0d5e135b474ae9baf05d281cf94b1
to blob 159828e44b9ee2b4940da5398c75d6353a6f1532
missing blob 159828e44b9ee2b4940da5398c75d6353a6f1532
Verifying commits in commit graph: 100% (123/123), done.

So the blob 159828e44b9ee2b4940da5398c75d6353a6f1532 was missing.

I had to use an backup and then the following commands on the repository backup to restore the missing blob:

git show 159828e44b9ee2b4940da5398c75d6353a6f1532 > /tmp/bkp git hash-object -w /tmp/bkp

And everything work as expected again.