运行git gc --aggressive时出错

时间:2013-01-17 16:47:53

标签: git ubuntu-12.04

运行'git gc'时出现以下错误:

    chris@chris-VirtualBox:~/code/dataquality$ git gc --aggressive
Counting objects: 3849, done.
error: object file .git/objects/1e/6a84c4e4202c469c188b69fd23407fca44d69d is empty
error: unable to find 1e6a84c4e4202c469c188b69fd23407fca44d69d
error: object file .git/objects/95/9dbfcdfd3ef09088e652d4e5526df66bc53323 is empty
error: unable to find 959dbfcdfd3ef09088e652d4e5526df66bc53323
error: object file .git/objects/9c/3f15a856fda402d82131bb9ea35ea7d27ae05d is empty
error: unable to find 9c3f15a856fda402d82131bb9ea35ea7d27ae05d
error: object file .git/objects/cf/bdc18aab11c9cbada9fb1ac73c347352b7a4fb is empty
error: unable to find cfbdc18aab11c9cbada9fb1ac73c347352b7a4fb
error: object file .git/objects/db/0ee0587a14cc0cdfa43ccda0d0b2010c7701b6 is empty
error: unable to find db0ee0587a14cc0cdfa43ccda0d0b2010c7701b6
Delta compression using up to 8 threads.
Compressing objects: 100% (3539/3539), done.
error: object file .git/objects/db/0ee0587a14cc0cdfa43ccda0d0b2010c7701b6 is empty
fatal: loose object db0ee0587a14cc0cdfa43ccda0d0b2010c7701b6 (stored in .git/objects/db/0ee0587a14cc0cdfa43ccda0d0b2010c7701b6) is corrupt
error: failed to run repack

我不知道如何解决错误。我应该采取什么措施?

当我运行git fsck --full时,这是输出:

chris@chris-VirtualBox:~/code/dataquality$ git fsck --full
error: object file .git/objects/1e/6a84c4e4202c469c188b69fd23407fca44d69d is empty
fatal: loose object 1e6a84c4e4202c469c188b69fd23407fca44d69d (stored in .git/objects/1e/6a84c4e4202c469c188b69fd23407fca44d69d) is corrupt

1 个答案:

答案 0 :(得分:0)

由于git fsck --full在新克隆上返回了相同的错误,因此在分支中使用了损坏的对象。 git help fsck的讨论部分可以说明您的情况:

       Any corrupt objects you will have to find in backups or other archives 
       (i.e., you can just remove them and do an rsync with some other site in
       the hopes that somebody else has the object you have corrupted).

因此,如果您使用此对象的旧克隆,您可能能够恢复。如果您没有备份this answer可能对您有用。