简体   繁体   中英

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 :

error: file .git/objects/pack/pack-{some_hash_here}.pack is far too short to be a packfile

warning: packfile .git/objects/pack/pack-{some_hash_here}.pack cannot be accessed

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. 在此处输入图片说明

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.

Run git fsck to see what the tool reports - in all likelihood, one of your pack files got deleted or corrupted. 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.

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. I ran "git gc" from Linux and it solved the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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