git致命:找到SHA1 COLLISION

时间:2014-05-30 22:05:52

标签: git

我似乎有一个损坏的回购,我不知道如何解决...

$ 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.

这是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

有关如何处理此问题的任何想法?我基本上想要获取遥控器中的任何内容并在此基础上推送我的一些提交。

4 个答案:

答案 0 :(得分:45)

我遇到了同样的问题然后跑了:

git prune
git gc  

提到:

  

错误:refs / remotes / origin / ticketName

的错误引用

所以我删除了引用并修复了问题:

rm .git/refs/remotes/origin/ticketName

答案 1 :(得分:8)

我认为repo被EGit或SourceTree(我并行使用)破坏了,并且与实际的哈希冲突无关。我按照评论的建议,通过将遥控器克隆为新的仓库并复制我的更改来解决它。

答案 2 :(得分:6)

我有一个类似的问题,并通过运行来解决它:

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

并删除上面的参考:

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

最后我能够运行git pull

答案 3 :(得分:0)

我运行了以下命令:

git prune
git gc 

并删除了.git \ refs \ remotes \ origin \ master文件(错误列出的文件:错误的引用)

然后运行

git gc --prune=now

解决了该问题。

相关问题