Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

index file smaller than expected

Tags:

git

This morning, I started getting this error from git:

fatal: index file smaller than expected

fatal: git status --porcelain failed

Any idea of what is happening and how to solve it?

like image 265
karellm Avatar asked Apr 09 '12 16:04

karellm


2 Answers

The index file has become corrupted, but it is easily re-creatable. Just remove it...

rm .git/index 

Then you can re-add the files you're trying to stage.

like image 147
meagar Avatar answered Sep 24 '22 15:09

meagar


If you want to keep local changes, use the following:

$ rm .git/index $ git reset HEAD .  > Unstaged changes after reset:   modified foo.txt   modified bar.txt 
like image 38
Scott Paradis Avatar answered Sep 24 '22 15:09

Scott Paradis