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…

    原文作者:馒头
    原文地址: https://segmentfault.com/a/1190000018058226
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞