Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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): pack files

Here is the full error message: pack error

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. enter image description here

like image 287
davidhaskins Avatar asked Jul 02 '14 21:07

davidhaskins


2 Answers

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.

like image 102
davidhaskins Avatar answered Nov 04 '22 09:11

davidhaskins


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.

like image 35
Derek Redfern Avatar answered Nov 04 '22 10:11

Derek Redfern