mac os 下好像内置就安装了 git, 在终端下运行 git --version
, 会显示 git version 2.14.3 (Apple Git-98)
。这个 git 所在的位置:\usr\bin\git
。
Do not uninstall Apple-distributed Git. You can leave it as it is and run another version by having it in a directory earlier in PATH
environment variable.
The easiest way to install another version on OS X would be to use Homebrew packet manager.
you can run:
brew install git && brew install bash-completion
Add bash-completion to your ~/.bash_profile:
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
使 .bash_profile 生效,运行 source .bash_profile
。