Git“bad sha1 file”错误

9

你好,我在使用git-fsck时遇到了以下错误,即使在--aggressive模式下也无法通过git-gc清理。下一步该怎么办来修复这个仓库错误?

$ git-fsck
bad sha1 file: .git/objects/55/tmp_obj_a07724
3个回答

8
很遗憾,这不是一个简单的答案。但这可能会有所帮助:
从 Git 用户手册中了解 恢复存储库损坏 的方法。

2
此链接为404。 - 2540625

7

嗯... tmp_obj_a07724 看起来很像是一个残留的临时文件 :)

如果你将其从 .git 目录中移开(在备份整个目录之后),会发生什么呢?


1
在执行 git gc --aggressive 后,我发现 .git/objects/??/tmp_obj_?????? 目录下有几个大小为零的文件。删除这些文件后,这个提示信息消失了,而且代码库看起来依然完好无损。 - akaihola

0

来自man git-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).

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接