This is helpful if you've previously installed git from source on OSX, and other compilers can't find the correct path. You need to remove the current version of git, then re-install with brew.
-
Check which git you're running:
which git
output should be similar to this: /usr/bin/git
-
Remove that git install
sudo rm -rf /usr/bin/git/ sudo rm /etc/paths.d/git sudo rm /etc/manpaths.d/git sudo pkgutil --forget --pkgs=GitOSX\.Installer\.git[A-Za-z0-9]*\.[a-z]*.pkg
brew uninstall git
brew update
brew install git
Check which git you're now running:
which git
Should now say: /usr/local/bin/git
@taejunoh Glad I could help but see my last answer. You might have encountered the same case as I did where the current terminal window where you ran
brew install git
will not recognize the proper path to the new git regardless of what's in$PATH
.You can test if you experienced the same as me by commenting that line you added/saving the file, opening a new terminal, and running
git --version
. If your case was anything like mine, you'll notice that it now works as expected without requiring any aliases or changes to$PATH
. If your new terminal still doesn't display the new version then you can uncomment that line.