git fatal: index file smaller than expected

Error message from git:

git fatal: index file smaller than expected

Cause: Index files are corrupted.

Solution: Remove and rebuild the index:

rm .git/index
git add .
git reset HEAD