fatal: Not a git repository (or any of the parent directories): .git
I had the same problem after upgrading to Sierra. In addition to
brew --prefix, which displays Homebrew’s install path, there’s also
brew --repository, which displays where it’s
git directory is located.
man brew says that claims that “for standard installs, the prefix and repository are the same directory”. Either the man page is out of date or my install isn’t “standard”, but my
/usr/local and my
/usr/local/Homebrew. Using the same command but with
cd $(brew --repository) worked for me:
cd $(brew --repository) && git fetch && git reset --hard origin/master
One way to get that error message is to somehow not be in the git repo working tree.
git clone I get a “
fatal: Not a git repository (or any of the parent directories): .git ” error” as an illustration.
In both case, resetting the situation in a new clone (which you did) usually is a good way to fix the situation.