错误:目标文件为空.git / objects /../ ..为空 - 致命:松散对象...已损坏 [英] error: object file is empty .git/objects/../.. is empty -- fatal: loose object ... is corrupt

查看:961
本文介绍了错误:目标文件为空.git / objects /../ ..为空 - 致命:松散对象...已损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以这是过去三周发生的第五次,而且我为什么会这样继续发生,我真的很难过。这是我在做'git status'时得到的确切消息。

 错误:object file .git / objects / 48 / 088f00d90b0d27de65336bb9ed9a75b0cfed33是空的
致命:松散对象48088f00d90b0d27de65336bb9ed9a75b0cfed33(存储在.git / objects / 48 / 088f00d90b0d27de65336bb9ed9a75b0cfed33中)已损坏

我尝试了一些建议,例如删除损坏的对象,但随后出现与另一个松散对象相同的错误。每次我做完这些,最终都会有大约30个松散的对象,我必须删除它们,然后在所有损坏的对象都消失后仍然会给我一个错误。



这是第五次发生这种情况,git或与之相关的东西必须有错误。我试过重新安装git,但我仍然以腐败的对象结束。我正在使用运行Ubuntu的虚拟机,如果这会导致这样的事情,我不知道。我也尝试切换到Linux mint,并反驳这个问题。



最后,我总是将更改保存到文本文件,删除了我的存储库,从git集线器中取出新的存储库,然后重新编辑这些更改。这种方法很有效,但它非常耗时并且远非理想。我不一定在寻找解决这个问题的方法,而是什么导致它,以及如何防止它再次发生。

解决方案

这通常不会发生,因为git首先将文件内容写入临时文件,然后将文件重命名为最终位置。实际上,由于文件系统损坏,我确实看到了空的Git对象文件(VirtualBox的vboxsf,用于文件夹共享,似乎是有罪的,只要我看到有人抱怨像这样的空文件)。



设置 core.fsyncobjectfiles true 可能有所帮助。


So this is the fifth time this has happened in the past three weeks and I am really stumped as to why this keeps happening. This is the exact message I get when I do 'git status'

error: object file .git/objects/48/088f00d90b0d27de65336bb9ed9a75b0cfed33 is empty
fatal: loose object 48088f00d90b0d27de65336bb9ed9a75b0cfed33 (stored in .git/objects/48/088f00d90b0d27de65336bb9ed9a75b0cfed33) is corrupt

I've tried recommendations such as deleting the corrupt object, but then the same error comes up with another loose object. Every time I've done this, there ends up being around 30 loose objects which I have to delete and then it still gives me an error after all of the corrupt objects are gone.

Being the fifth time this happened, something has to be wrong with git or something related to it. I have tried re-installing git, but I still ended up with the corrupt objects. I am using a virtual machine running Ubuntu, if that would cause something like this, I don't know. I have also tried switching to Linux mint and I countered this problem as well.

In the end I have always just saved the changes to a text file, deleted my repository, pull fresh repository from git hub and then edit the changes back in. That works but it is time consuming and far from ideal. I'm not necessarily looking for a way to fix this, but rather what is causing it and how to prevent it from happening again.

解决方案

This should normally not happen, since git first writes the file content in a temporary file, and then renames the file to its final location. In practice, I did see empty Git object files due to a broken filesystem (VirtualBox's vboxsf, used for folder sharing, seems to be the guilty one whenever I saw people complaining about empty files like this).

Setting core.fsyncobjectfiles to true may help.

这篇关于错误:目标文件为空.git / objects /../ ..为空 - 致命:松散对象...已损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆