'fatal: not a git repository (or any of the parent directories): .git'

git, github

Solution

In my case, accidentally `.git/HEAD` file was messed up with non unknown characters, but `.git/ORIG_HEAD` file was ok (it has commit id). So, I copied `.git/ORIG_HEAD` content to `.git/HEAD` file. Then restarted IDE (Aptana) and everything worked fine.

Problem

fatal: not a git repository (or any of the parent directories): .git is the error I'm getting when I try to perform any git operation on my repository. I made some changes to my project which is the repository. Then I tried `git status` to look over my changes and encountered this error. I Googled this error but didn't make any progress. It seems this error is most common when trying to perform git operations in a directory that's outside the repository which isn't the case for me. Also I tried checking my ./git/HEAD and ./git/logs/refs/heads both of which are empty files. `./git/logs/refs/remotes/origin/master` is also empty. So from the beginning: - I made an Android project in this directory on one computer. - I initiated a git on this directory and posted it on github. - I followed the usual online guides for pulling this repository onto 2 other computers. - Made some changes on another computer, pushed the changes to the repository. - Then on the original computer I successfully pulled the changes. - After not working on the project for a few days, I made some changes on the original computer, tried to git status and this happened.

Original source

Related problems