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
Doing the following worked for me in the following situation:
brew install git
on my user's base directory (the directory you get to if you runcd
by itself) - Not sure if brew installs it to current directory or somewhere specifically, I only know that Git's official website suggests cloning, which is directory sensitive so I did this because I didn't have much luck doing it right via Git's github clone).alias git='/usr/local/bin/git'
git --version
again to check and the intended effect was achieved, I am now on git version 2.33.0 as intended.which git
to check that as well and all is good, now I just have Apple's older git somewhere on my SSD but I don't really give a crap, the new one works as intended so I'll sacrifice that tiny bit of uselessly spent memory lol.