I just had the same problem.
From GIT source, error is thrown when command git diff-index HEAD returns result, even if git status says working tree is clean.
To avoid this error, in my case, I re-checkout the current branch of working tree , and everything seems OK : git checkout <branch>
It’s a bit confused, but if someone can explain why …