1

最近,我注意到,当我在git pulling 我的 repo 时,它每次都在做git gc一次。所以我尝试git gc手动运行,这给了我这个错误:

fatal: bad object 76cab35e0e21b7cf0bc8416661a67fbfb7f0e4ba
error: failed to run repack

然后,我尝试搜索.git/packed-refsand.git/objects/.git/index查找此哈希(甚至尝试仅在整个.git/目录的文件名和内容中搜索此哈希),但它从未出现. 它也没有出现在git fsck --full(我猜这可能是指 中的某些文件.git/,所以这是有道理的)。

我该如何解决?(我正在使用git 2.3.2。)

4

1 回答 1

3

This happens because reflog has references to entries that have somehow vanished from the filesystem. Running git gc with --prune="0 days" will remove all references that are older than now that aren't tracked in the remote origin, and should fix the issue.

于 2015-03-12T22:18:45.107 回答