How to upgrade Git (Mac OSX)

Problem : Git vulnerabilities CVE-2016–2324 and 2315
Solution : Update it :)

Check version

$ git --version

Backup (or remove) Apple git (Optional)

$ sudo mv /usr/bin/git /usr/bin/git-apple

Install Homebrew if you didn’t have

$ /usr/bin/ruby -e "$(curl -fsSL"

Or update if you already have

$ brew update && brew upgrade

Install Git with Homebrew

$ brew install git

Symbolic link

$ brew link --force git

Close Terminal and reopen then check version

$ git --version

You should see…

git version 2.8.2

Nice! We’re safe now! And next time you can just…

$ brew update && brew upgrade

Happy Gitting!