如何恢复损坏的git存储库?

编程入门 行业动态 更新时间:2024-10-15 12:29:02
本文介绍了如何恢复损坏的git存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的git提交后冻结的笔记本电脑硬重置后,出现以下错误:

$ git status 致命:无法读取对象de02e6d5cd7823ea788429a33583bede09221163:无效参数

有没有办法恢复我的git仓库?

我从以下两个问题中找不到解决方案:

  • 如何在git仓库中恢复损坏的对象(对于新手)?
  • 如何恢复因硬盘故障而损坏的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存储库?

本文发布于:2023-06-06 01:37:11,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:git

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!