MacOS安装git

1。安装brew(可百度brew官网,参考安装)

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2.安装git

brew install git

3.备份旧的git

cd /usr/local/bin
mkdir backup-git
mv git* ./backup-git/

4.找到新的git安装目录

cd /usr/local/Cellar/git/2.20.1

5.回到根目录,配置环境变量

cd ~
vim .bash_profile
#输入
export GIT=/usr/local/Cellar/git/2.20.1
export PATH=$GIT/bin:$PATH

:wq

6.刷新环境变量,使配置生效

source .bash_profile

参考资料:[1]: https://www.cnblogs.com/songt...

相关推荐