Having an invalid HEAD file causes git not to recognize the repository
- From
- Egon Elbre <egonelbre@gmail.com>
- Date
- Aug 17, 2012, 11:42 UTC
- Message-ID
- <CANtNKfp+9HpvWkAO0vrm84oMiJNvjFg9T-UtNQko+ABHhEWj6w@mail.gmail.com>
Having an invalid HEAD file causes git not to recognize the repository and will cause an invalid message "fatal: Not a git repository (or any of the parent directories): .git" although there is a .git folder and everything seems okay in it. Solution was just to change HEAD to a valid ref/hash.
I ran into this problem when I had a BSOD during a rebase (ignore that I'm having to use Windows). This meant that only half of the hash got written into HEAD and all git commands I tried failed.
Not sure whether it's useful to add a better message for this case, but at least if somebody stumbles on it again, maybe they can find this text.
+ egon