【发布时间】:2015-07-23 13:53:57
【问题描述】:
环境:Mac OSX 10.10。当我尝试使用gitk 时,它显示:
Coda-2:~ Coda$ gitk
-bash: gitk: command not found
我认为原因是git 的旧版本。这是一些信息,我已经输入了brew update。
Coda-2:~ Coda$ git --version
git version 1.9.3 (Apple Git-50)
Coda-2:~ Coda$ brew install git
Warning: git-2.4.0 already installed, it's just not linked
这条消息是什么:it's just not linked?
另外,我查看git的路径:
Coda-2:~ Coda$ which git
/usr/bin/git
应该在/usr/bin/local/git?如何解决?
更新
我明白了,谢谢@TimCastelijns。
brew doctor 说:
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
git
所以,我输入了:
Coda-2:~ Coda$ brew link git
Linking /usr/local/Cellar/git/2.4.0... 220 symlinks created
然后我输入了gitk,它成功了,路径更改为/usr/local/bin/git。但是,当我想检查git 的版本时。它仍然显示旧版本,为什么?
Coda-2:~ Coda$ git --version
git version 1.9.3 (Apple Git-50)
【问题讨论】:
-
什么是未链接的?表示如果您输入
git,它将使用旧安装,而不是新安装 -
哈哈!我现在知道了!谢谢,我知道了!
-
但是,我链接了新版本,
gitk也可以,为什么当我输入which git时它仍然显示旧版本的 git -
使用
type,而不是which。 -
对不起,我添加了错误的命令。我的意思是我输入
git --version,它不应该显示git version 2.4吗?但它告诉我git version 1.9.3