运行“git Push”时出现损坏错误
我尝试运行 git push 并收到损坏错误:
% git push
Counting objects: 62, done.
Delta compression using up to 2 threads.
error: corrupt loose object 'f2310668fe335b36c513e50fcd99744e8fd5c2e0'
fatal: object f2310668fe335b36c513e50fcd99744e8fd5c2e0 is corrupted
error: pack-objects died with strange error
该错误挂在最后一行,直到我按 Ctrl+C。
我读到运行 git gc 可能会有所帮助,所以我这样做并得到了类似的错误:
% git gc
Counting objects: 493, done.
Delta compression using up to 2 threads.
error: corrupt loose object 'f2310668fe335b36c513e50fcd99744e8fd5c2e0'
fatal: object f2310668fe335b36c513e50fcd99744e8fd5c2e0 is corrupted
error: failed to run repack
我应该做什么来解决这个问题?
I tried to run git push
and got a corruption error:
% git push
Counting objects: 62, done.
Delta compression using up to 2 threads.
error: corrupt loose object 'f2310668fe335b36c513e50fcd99744e8fd5c2e0'
fatal: object f2310668fe335b36c513e50fcd99744e8fd5c2e0 is corrupted
error: pack-objects died with strange error
This hangs on the last line until I hit Ctrl+C
.
I read that running git gc
might help, so I did that and got a similar error:
% git gc
Counting objects: 493, done.
Delta compression using up to 2 threads.
error: corrupt loose object 'f2310668fe335b36c513e50fcd99744e8fd5c2e0'
fatal: object f2310668fe335b36c513e50fcd99744e8fd5c2e0 is corrupted
error: failed to run repack
What should I do to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
克隆存储库的备份。如果损坏的对象 ID 是 $OBJECTID,请执行以下操作:
在新存储库中:
将这两个新文件移动到旧存储库
在损坏的存储库中,移走损坏的对象:
这应该将对象写入 git 的数据库,并将 $OBJECTID 输出到 STDOUT 。如果它输出一些其他 SHA1 id,则说明您犯了一个错误,您应该删除该错误的对象。
Clone a backup of your repository. If the corrupted object id is $OBJECTID, do this:
In new repository:
Move those two new files to the old repository
In corrupt repository, move away your corrupt object:
This should write the object into git's database, and output $OBJECTID to STDOUT. If it outputs some other SHA1 id, you have made a mistake and you should delete that wrong object.
看起来它是您自己最近尝试推送的对象之一,其中包含损坏的对象。 。
然后,在远程跟踪分支之上重新调整您的更改 这应该不会执行任何操作
如果您处于快进情况,那么如果不是 ff 情况,
,您应该在提交上收到错误,该错误要么本身已损坏,要么在它指向的树和 blob 结构中指向的内容。如果这是一种 ff 情况,请
不要进行任何更改。保存并退出,git 将在其所在位置重写提交。这应该不会导致任何提交失败,从而帮助您追踪坏对象。
希望这有帮助
looks like it is one of your own recent objects that you are trying to push that contains a corrupt object. Do
then rebase your changes on top of the remote tracking branch. If you're in a fast forward situation, this should do nothing
if it's not a ff situation, you should be getting an error on the commit that is either itself corrupt or something it points to in the tree and blob structure it points to.
If this was a ff situation, do a
don't change anything. Save and quit and git will rewrite the commits on top of where they are. This should fail no a commit that will help you track down the bad object.
hope this helps
您可以尝试从外部源重新克隆您的存储库,然后从您自己更改的存储库中获取更改。如果缺陷对象不是由您自己的提交之一创建的,则此方法有效。
您还可以尝试从新克隆中提取对象 f2310668fe335b36c513e50fcd99744e8fd5c2e0 并将其放入
.git/objects/f2/310668fe335b36c513e50fcd99744e8fd5c2e0
中,然后再次运行git gc
,但请使用您的存储库副本执行此操作。You can try to re-clone your repo from an external source, and then fetch the changes form your own changed one. This works if the defect object is not created by one of your own commits.
You can also try to extract object f2310668fe335b36c513e50fcd99744e8fd5c2e0 from the fresh clone and place it into
.git/objects/f2/310668fe335b36c513e50fcd99744e8fd5c2e0
and rungit gc
again, but do this with a copy of your repo.