gitservergit-pullgit-clonegit-fsck

git server error: corrupt loose object on remote


I have an error in response to git fsck --full which is corrupt loose object '...' on a git server machine. I don't have a local repository. I can't clone. I don't have the object in repo/objects/...

Do you have any ideas on how to fix this? The object is not inside the repo.git/objects directory. I can ssh inside the server machine.

any suggestion is highly appreciated. Thanks

EDIT

I've tried with

git gc --prune

but i'm receiving the same error

error: inflate: data stream error (invalid distance code) error: corrupt loose object '4e4c................' fatal: object 4e4c............. is corrupted error: failed to run repack

EDIT 2

git gc --aggressive --prune=now

gives me the same error and also

git gc --aggressive --prune=all

With

git ls-tree 4e4cc....

I have the same error

EDIT 3

I've found a local repo(of 10GB) with the last commit and I can push to the remote (of 20GB). I can also pull from that local. Why they are different in size? I still can't clone... and the obj 4e4c............. is not inside .git/objects/


Solution

  • I've resolved the problem. Git stores an object like 4e4cfe... creating a directory 4e (ex.repo/objects/4e/) and putting the object 4cf3... inside that directory. I was searching for the object 4e4cfe... and, of course, I couldn't find it. However the object was corrupted but I had found a good one (after git fsck --full -v) inside a local repository and I just copied it in the remote repository. So at the end to resolve the problem you need a simple "copy and paste".