git git存储库无法遍历父错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6713126/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 05:41:44  来源:igfitidea点击:

git repository failed to traverse parent error

git

提问by Peter Harrison

I am a newcomer to git and was quite happy until this evening. I have been committing changes regularly. I maintain two remotes on unfuddle and beanstalk and a local filesystem remote.

我是 git 的新手,直到今天晚上都很开心。我一直在定期进行更改。我在 unfuddle 和 beanstalk 上维护两个遥控器以及一个本地文件系统遥控器。

Never had an error and after a days work, I push my changes up to all the remotes believing that woud keep me pretty safe. There were no errors and no problems.

从来没有出现过错误,经过一天的工作,我将我的更改推送给所有遥控器,相信这会让我非常安全。没有错误,也没有问题。

This evening, I went to look over the log of my project and got this error for my pains:

今天晚上,我去查看我的项目的日志,并为我的痛苦得到了这个错误:

error: Could not read a2b6c2fa16e01db9e38d9509606a444e5831330a
fatal: Failed to traverse parents of commit 
       78e81a9a7f5cafa5e2af4b95d156364b9a430ac9

As far as I can see the history is good as far back as May 29th. I cannot clone a copy from any of the remotes. There are no other clones anywhere that I could use to recover the repository. I don't even really know when it broke. I checked the FAQ but I have no idea what the author of the repository recovery section is talking about.

据我所知,历史可以追溯到 5 月 29 日。我无法从任何遥控器克隆副本。在任何地方都没有其他克隆可用于恢复存储库。我什至不知道它什么时候坏了。我查看了常见问题解答,但我不知道存储库恢复部分的作者在说什么。

WhenI run git fsck, I get 155 lines of missing this and dangling that. Clearly, I would like to get this cleaned up. I can live with no history prior to May 29th If I could get it straight from then onwards.

当我运行 git fsck 时,我得到 155 行缺少这个和悬空那个。显然,我想把它清理干净。如果我能从那以后直接得到它,我可以在 5 月 29 日之前没有历史记录。

Can anyone help me get this straight?

任何人都可以帮我弄清楚吗?

Also, what could cause this? The only thing I can think of that has changed in that period is that I upgraded netbeans to v7 which is supposed to have git support but seems not to recognise existing repositories.

另外,这可能是什么原因造成的?在那个时期我能想到的唯一改变是我将 netbeans 升级到 v7,它应该有 git 支持,但似乎无法识别现有的存储库。

回答by weston

I googled this error and found your page, in my case the problem was that I had done:

我用谷歌搜索了这个错误并找到了你的页面,就我而言,问题是我已经完成了:

git clone --depth 1 https://github.com/example/nifty.git

but months later, forgetting that I had only grabbed the latest commits, when I tried to push it to another remote it complained. It took me a little while to figure out that it wasn't a damaged repo but just the fact that I never had the parent commits! Hopefully that helps someone.

但是几个月后,忘记了我只抓取了最新的提交,当我试图将它推送到另一个遥控器时,它抱怨了。我花了一点时间才发现这不是一个损坏的回购,而只是我从未让父提交的事实!希望这可以帮助某人。

This fixed it for my case:

这为我的情况修复了它:

git fetch --unshallow

回答by Ryan Stewart

"Dangling" objects may not be a problem. It could just mean that you've done some resetting, rebasing, and/or deleted branches that weren't fully merged. "Missing", on the other hand, is more serious, I believe. Take a look at this article on repairing a damaged repo. That might help you out. You could also try upgrading git if you're out of date. A newer version might be a little smarter.

“悬空”对象可能不是问题。这可能只是意味着您已经完成了一些未完全合并的重置、重新定位和/或删除的分支。我相信,另一方面,“失踪”更为严重。看看这篇关于修复损坏的 repo 的文章。那可能会帮助你。如果你已经过时了,你也可以尝试升级 git。较新的版本可能更聪明一些。