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.


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


Answered By – B–rian

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published