Read more

How to fix a corrupt git index

Arne Hartherz
February 08, 2012Software engineer at makandra GmbH

If your git index for some reason becomes invalid, no need to worry.

Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

Your index is corrupt when you see this error running usual git commands like git pull, git status, etc.:

error: bad index file sha1 signature
fatal: index file corrupt

Though it sounds bad, your changes are still there. Fix it by first removing the index file, then resetting the branch:

rm .git/index
git reset

You should be all good now.

To be safe, make a backup of .git/index before you delete it.

Posted by Arne Hartherz to makandra dev (2012-02-08 11:38)