如何恢复损坏的git存储库? [英] How to restore a corrupted git repository?
问题描述
在我的git提交后冻结的笔记本电脑硬重置后,出现以下错误: $ git status
致命:无法读取对象de02e6d5cd7823ea788429a33583bede09221163:无效参数
有没有办法恢复我的git仓库?
我从以下两个问题中找不到解决方案:
编辑:我没有找到什么导致我的git存储库的腐败,也没有任何解决方案来恢复它...我终于开始从我的SVN仓库中复制一个新的克隆!
对于我来说,上述答案都不起作用。我刚刚重新克隆了我的git回购,一切都很顺利。在克隆之前,我打开了所有更改过的文件,并在拉出后将其覆盖。
这就是为什么你经常犯下这个错误的原因:)。 $ b
After a hard reset of my laptop that freezed after a git commit, I have the following error when I enter any command on my git repository:
$ git status
fatal: failed to read object de02e6d5cd7823ea788429a33583bede09221163: Invalid argument
Is there anyway to recover my git repository?
I did not find a solution from the two following questions:
- How do you restore a corrupted object in a git repository (for newbies)?
- How to recover Git objects damaged by hard disk failure?
EDIT: I did not found what caused the corruption of my git repository nor any solution to restore it... I finally started over a new clone from my SVN repository!
For me, none of the above answers worked. I just re-cloned my git repo and all was well. Before cloning, I opened up all the files that were changed and just overwrote them after the pull.
That's why you should commit often :).
这篇关于如何恢复损坏的git存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!