Here is my case:
But suddenly
Some time it may also occur due to file permission problems, check if you have appropriate permissions on all the files under the repository.
Had the same problem. Removing .git\refs\heads\ fixed the problem for me.
I meet similar issue on Windows 7. In my case,the current branch file (refer by ./git/HEAD
) under \.git\refs\heads
was broken.
I found the hash code of broken current branch on .git\logs\refs\heads
with same branch name.
And I fixed the issue by opening that file (.git\logs\refs\heads\xxx
) via notepad and copy the 4th number (the hash code) to (.git\refs\heads\xxx
)