6

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.

B--rian
  • 5,578
  • 10
  • 38
  • 89
pbuchheit
  • 1,371
  • 1
  • 20
  • 47

2 Answers2

3

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

B--rian
  • 5,578
  • 10
  • 38
  • 89
  • 1
    @pbuchheit I edited my answer again. I forgot to mention that I also suggest to run `git-fsck` **on the remote server** since one of your error messages suggests that it is not a local issue. Do you have access to the remote repo? – B--rian Sep 25 '19 at 12:51
  • I think you may have given me the angle I needed. Gitlab has a built in tool to run an fsck on the remote repos. I ran that and there do indeed seem to be problems there. The next question I suppose is how to fix the errors that fsck is reporting? – pbuchheit Sep 25 '19 at 13:43
0

I encounter this error when transfer my git repo from Mac OS to another system. Files start with '._' are Mac OS meta files generated by tar command. So look at this question to avoid '._*' files: Tar command in mac os x adding "hidden" files, why?

Ben Town
  • 1
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 12 '22 at 21:45