macos系统里自带了 2.17.2版本的git,我想安装官方的最新版git,又习惯使用homebrew.
- 去官网下载最新版的 目前是2.19.2
- 安装dmg包
- 编辑.bash_profile 文件
配置:
原理:git在mac上安装的目录:/usr/local/git/ 将这个目录配置进系统环境变量里
操作命令:
vim ~/.bash_profile
编辑内容:
1.vim .bash_profile
export GIT_HOME=/usr/local/git
export PATH=$GIT_HOME/bin:$PATH
使系统变量生效:
source ~/.bash_profile
验证:
git --version
git version 2.19.2