Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resolving Errors With Git Index Too Small

I recently updated the development server that hosts our code repos to a newer version of Ubuntu (18.04). As part of the process git was upgraded to version 2.23.0. The actual application servers where the code gets deployed to need to be able to checkout the latest changes from the git repos. When I try to do a 'git fetch' on those servers I get a long list of errors that look like this:

error: index file ./objects/pack/._pack-5b58f700fea57ee6f8ff29514a376b945bb1c8a9.idx is too small

I did some digging around to see if I could come up with a solution but so far noting has worked. I tried the answers listed here: git error: "index file is too small" . Neither git index-pack nor git repack -a -d solved the issue. I even tried deleting the local copy of the files from the application server and installing fresh using git clone. The clone itself threw a bunch of errors similar to before

remote: error: index file ./objects/pack/._pack-5b58f700fea57ee6f8ff29514a376b945bb1c8a9.idx is too small

At this point I'm out of ideas. Any help would be appreciated.

Edit: The output of du -h suggests that there is enough disk space.

like image 251
pbuchheit Avatar asked Sep 20 '19 15:09

pbuchheit


Video Answer


1 Answers

The error message sounds like file corruption. If you have not run out of disk space, you can delete the index file and recreate it with:

git index-pack -v ./objects/pack/._pack-5b58f700fea57ee6f8ff29514a376b945bb1c8a9.idx

You might also want to run use git-fsck to verify the connectivity and validity of the objects in the GIT database -- both the remote the local one.

If your index is corrupt, you can also try to reset the branch which will create a new index file:

  1. To be safe, backup .git/index.
  2. Remove the index file .git/index.
  3. Perform git reset

References

  • The issue is a possible duplicate of git error: "index file is too small"
  • Documentation on git index-pack can be found at https://git-scm.com/docs/git-index-pack
  • Some notes on repairing a broken index: https://makandracards.com/makandra/5899-how-to-fix-a-corrupt-git-index
  • fatal: packfile name 'server' does not end with '.pack'
like image 78
B--rian Avatar answered Nov 12 '22 00:11

B--rian