Upgrade Git on Mac
Recently, I’ve tried to use GnuPG signing my commits, but some wierd phenomemon appear. To eliminate other factors that affect the problem, I’ve tried to upgrade my Git release on Mac OS X.
check git version and back up original git version
$ git –version
git version 2.10.1 (Apple Git-78)
$ sudo mv /usr/bin/git /usr/bin/git-appleUpdate homebrew(already installed supposed)
$ brew update && brew upgrade
If you’ve not heard Homebrew or not installed before, install brew firstly.
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install Git with Homebrew
$ brew install git
(if not linked) Fix symblic link
$ brew link –force git
If symbolic link is already linked, this won’t cause any harm.
Close Terminal and reopen then check version
$ git –version
And you shall see…
git version 2.18.0
Nice! We are safe now! And next time you just need to…
$ brew update && brew upgrade
And this script will automatically upgrade all the softwares installed by brew.
Ref:
Author: d0zingcat
Link: https://infloop.life/2018/07/28/upgrade-git-on-mac/
License: 知识共享署名-非商业性使用 4.0 国际许可协议