git fatal: SHA1 COLLISION FOUND

匿名 (未验证) 提交于 2019-12-03 02:16:02

问题:

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.

回答1:

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 


回答2:

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.



回答3:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!