当我尝试使用刚刚通过自制软件安装的最新版本的 git 时,我遇到了一个非常奇怪的问题。which git
将我指向自制软件安装,但调用git
返回与 OS X 一起安装的原始版本。
我首先检查以查看我使用的原始版本。
[user@home ~]$ git --version
git version 1.8.5.2 (Apple Git-48)
Run Code Online (Sandbox Code Playgroud)
然后我去自制软件安装最新版本。
[user@home ~]$ brew install git
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-2.0.0.mavericks.bottle.2.tar.gz
######################################################################## 100.0%
==> Pouring git-2.0.0.mavericks.bottle.2.tar.gz
==> Caveats
The OS X keychain credential helper has been installed to:
/usr/local/bin/git-credential-osxkeychain
The 'contrib' directory has been installed to:
/usr/local/share/git-core/contrib
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completion has been installed to:
/usr/local/share/zsh/site-functions
==> Summary
/usr/local/Cellar/git/2.0.0: 1324 files, 31M
Run Code Online (Sandbox Code Playgroud)
看起来它奏效了!检查它是否指向正确的 git
[user@home ~]$ …
Run Code Online (Sandbox Code Playgroud)