brew update: "Warning git-2.9.1 already installed Error: Git must be installed and in your PATH!"

Created on 16 Jul 2016  Â·  5Comments  Â·  Source: Homebrew/brew

I'm on OS X 10.11.5
When I run brew update I now get this error

brew update
Warning: git-2.9.1 already installed
Error: Git must be installed and in your PATH!

While searching for the problem I found this issue https://github.com/Homebrew/legacy-homebrew/issues/49736

someone asked what which -a git returns:

which -a git
/usr/local/bin/git
/usr/bin/git

and cd $(brew --repository) && git pull returns:

cd $(brew --repository) && git pull
remote: Counting objects: 52, done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 52 (delta 41), reused 31 (delta 22), pack-reused 0
Unpacking objects: 100% (52/52), done.
From https://github.com/Homebrew/brew
   a02be9e..90e8445  master     -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master

and echo $GIT shows an empty line.

I don't know what else to check. Any ideas?

Most helpful comment

Thanks @retokromer for the help here!

Any idea what caused this?

We made a mistake during a refactoring that caused brew update to no longer find a valid Git installation. It was quickly fixed, but people who updated during that short period were stuck and needed to do the manual git fetch and git reset dance to get past this point.

All 5 comments

Run:

git fetch
git reset --hard origin/master
brew update
git fetch
fatal: Not a git repository (or any of the parent directories): .git

git reset --hard origin/master
fatal: Not a git repository (or any of the parent directories): .git

brew update
Warning: git-2.9.1 already installed
Error: Git must be installed and in your PATH!

Then:

git config --global core.autocrlf input
cd /usr/local
git config core.autocrlf false
git fetch origin
git reset --hard origin/master
brew update

should work

that did it, thanks!
Any idea what caused this?

git config --global core.autocrlf input
cd /usr/local
git config core.autocrlf false
git fetch origin
git reset --hard origin/master
HEAD is now at 90e8445 test-bot: re-add update-test. (#521)

brew update
Updated 3 taps (caskroom/cask, homebrew/core, homebrew/fuse).
==> New Formulae
cf4ocl                                                                              opencsg                                                                           
==> Updated Formulae
commandbox           diff-so-fancy        erlang               git ✔                homebrew/fuse/s3fs   nifi                 pkg-config ✔         youtube-dl ✔       
==> Renamed Formulae
commonmark -> cmark
==> Deleted Formulae
horndis

Thanks @retokromer for the help here!

Any idea what caused this?

We made a mistake during a refactoring that caused brew update to no longer find a valid Git installation. It was quickly fixed, but people who updated during that short period were stuck and needed to do the manual git fetch and git reset dance to get past this point.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zelsonia picture zelsonia  Â·  4Comments

hktalent picture hktalent  Â·  4Comments

MikeMcQuaid picture MikeMcQuaid  Â·  3Comments

stejmurphy picture stejmurphy  Â·  4Comments

cdekok picture cdekok  Â·  4Comments