在收到此错误之前,我立即执行以下操作:

user@thismachine:~/file/path$ git add *
user@thismachine:~/file/path$ git push
^C
user@thismachine:~/file/path$ git commit -m "my commitmesg"

(我感到恐慌是因为我在推送之前忘记添加提交,因此我将其cntrl + c了。

现在,我从git fsck --full收到以下错误:
error: inflate: data stream error (incorrect header check)
error: corrupt loose object '5cdeb9c3a1fe164cb4d2779d1e0d9d9f4ef18c6a'
fatal: loose object 5cdeb9c3a1fe164cb4d2779d1e0d9d9f4ef18c6a (stored in .git/objects/5c/deb9c3a1fe164cb4d2779d1e0d9d9f4ef18c6a)

git cat-file -t 5cdeb9c3a1fe164cb4d2779d1e0d9d9f4ef18c6a返回此对象是一个提交。

搜索之后,我发现如果对象是blob而不是提交,则如何解决此问题。

最佳答案

http://vincesalvino.blogspot.ca/2013/08/git-empty-files-corrupt-objects-and.html的解决方案使我可以解决此问题:

find .git/objects/ -size 0 -exec rm -f {} \;

关于git - 修复损坏的松散对象作为git中的提交,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12571557/

10-14 17:10
查看更多