简体   繁体   English

Git错误: <filename> 太短以至于无法打包文件

[英]Git error: <filename> is far too short to be a packfile

I am running Git on windows, and I could commit to my repository yesterday, but now I get the following errors when I try to commit or run git status : 我在Windows上运行Git,昨天可以提交到存储库,但是现在当我尝试提交或运行git status时出现以下错误:

error: file .git/objects/pack/pack-{some_hash_here}.pack is far too short to be a packfile 错误:文件.git / objects / pack / pack- {some_hash_here} .pack太短而无法成为packfile

warning: packfile .git/objects/pack/pack-{some_hash_here}.pack cannot be accessed 警告:packfile .git / objects / pack / pack- {some_hash_here} .pack无法访问

The file is on the file system here (I have full permissions on the file): 该文件在此处的文件系统上(我对该文件拥有完全权限): 打包文件

Here is the full error message: 这是完整的错误消息: 包装错误

What does this mean? 这是什么意思? How can I fix it? 我该如何解决? My googling isn't helping; 我的谷歌搜索没有帮助; any help is greatly appreciated! 任何帮助是极大的赞赏!

Update: ran git fsck --verbose and I get a similar error. 更新:跑git fsck --verbose和我得到一个类似的错误。 在此处输入图片说明

After rebooting my computer and remounting the drive, it works now. 重新启动计算机并重新安装驱动器后,它现在可以工作了。

ETA: I was able to RDP in to the server (as the same user) and run git normally while the error kept occurring locally. ETA:我能够RDP进入服务器(以同一用户身份)并正常运行git,而错误始终在本地发生。

Run git fsck to see what the tool reports - in all likelihood, one of your pack files got deleted or corrupted. 运行git fsck以查看该工具报告的内容-很可能是您的一个打包文件被删除或损坏。 If so, the easiest way to fix it (rather than trying to hunt down a backup of the pack file) is to save the changes you've made to the repository OUTSIDE of the git directory, then delete the directory and re-clone it from the remote repository. 如果是这样,修复该问题的最简单方法(而不是尝试查找该打包文件的备份)是保存对git目录的OUTSIDE存储库所做的更改,然后删除该目录并重新克隆它从远程存储库。

This will re-generate the pack files and everything else that you need so that you can then move your changes back in and commit them. 这将重新生成打包文件以及您需要的所有其他文件,以便您可以将更改移回并提交。

I had the same problem, using Git from Windows on a mapped Linux drive. 在映射的Linux驱动器上从Windows使用Git时,我遇到了同样的问题。 I ran "git gc" from Linux and it solved the problem. 我从Linux运行了“ git gc”,它解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM