Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git fatal: SHA1 COLLISION FOUND

Tags:

git

I seem to have a corrupted repo that I have no idea how to fix...

$ git pull
remote: Counting objects: 141, done.
remote: Compressing objects: 100% (90/90), done.
error: unable to unpack ff7fca002656ad848c44bf134088d638a01d5217 header
error: inflateEnd: stream consistency error (no message)
fatal: SHA1 COLLISION FOUND WITH ff7fca002656ad848c44bf134088d638a01d5217 !
fatal: index-pack failed
Unable to write to standard output: The pipe is being closed.

And this is the output from the fsck:

$ git fsck
error: unable to unpack 024e257c1a13532e7d5579b0ea4bb5915d21e4a6 header
error: inflateEnd: stream consistency error (no message)
fatal: loose object 024e257c1a13532e7d5579b0ea4bb5915d21e4a6 (stored in super/sectet/path/to/repo/.git/objects/02/4e257c1a13532e7d5579b0ea4bb5915d21e4a6) is corrupt

Any ideas on how to approach this? I basically want to get whatever is in the remote and push my few commits on top of that.

like image 316
ddinchev Avatar asked May 30 '14 22:05

ddinchev


3 Answers

I ran into the same issue and ran:

git prune
git gc  

which mentioned:

error: bad ref for refs/remotes/origin/ticketName

So i removed the reference and that fixed the issue:

rm .git/refs/remotes/origin/ticketName
like image 58
depperm Avatar answered Oct 13 '22 23:10

depperm


I think the repo got corrupted by either EGit or SourceTree (which I use in parallel) and has nothing to do with actually hash collisions. I solved it, as suggested by comments, by cloning the remote as a new repo, and copying my changes over.

like image 29
ddinchev Avatar answered Oct 13 '22 22:10

ddinchev


I have a similar issue and solved it by running:

$ git prune
Output: fatal: unable to parse object: refs/heads/prod-283

and just delete the reference above:

$ rm -f .git/refs/heads/prod-283

and finally I am able to run git pull

like image 6
rfajarachmad Avatar answered Oct 13 '22 22:10

rfajarachmad