您的位置:首页 > 其它

你的osx中没有gitk?

2015-10-19 14:14 423 查看
你的osx中没有gitk?一句话:你的git版本太低了,gitk是跟随git一起安装的。

解决办法:重新使用brew安装git就好了。

先看下git版本:

[code]andy@AndyMacBookPro:~$ git --version
git version 1.9.5 (Apple Git-50.3)


可以使用brew重新安装git:

首先升级brew:

brew update

然后安装git:

[code]andy@AndyMacBookPro:/usr/local/webdata/chrome_ext/fanlihelper$ brew install git
==> Downloading https://homebrew.bintray.com/bottles/git-2.6.2.mavericks.bottle.tar.gz ######################################################################## 100.0%
==> Pouring git-2.6.2.mavericks.bottle.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.6.2: 1398 files, 33M


安装之后发现git版本还是没有变:

[code]andy@AndyMacBookPro:/usr/local/webdata/chrome_ext/fanlihelper$ git --version
git version 1.9.5 (Apple Git-50.3)


我们使用which git,发现git的目录还是/usr/bin/git,按理git应该位于/usr/local/bin/git中才对,是目录在profile中没有设置好,所以我们先升级brew:

[code]brew upate


最后发现有此提示:

[code]Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
    echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile


然后我们根据提示来执行:

[code]echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile


参考()这里,这么说的:

If you already have git installed via homebrew, you can just do upgrade:

也就是说,刚刚我们已经brew install git过了,我们现在导入了path之后,我们可以直接:

brew upgrade git就可以了,效果如下:

[code]$ which git
/usr/bin/git
$ brew upgrade git
$ which git
/usr/local/bin/git


之后我们看到git版本正确了:

[code]andy@AndyMacBookPro:/usr/local/Cellar/git/2.6.2$ git version
git version 2.6.2


然后我们这时候在shell中执行gitk也可以了~~

最后我们看一下系统中的情况:

[code]andy@AndyMacBookPro:/usr/local/Cellar/git/2.6.2$ /usr/bin/git version
git version 1.9.5 (Apple Git-50.3)
andy@AndyMacBookPro:/usr/local/Cellar/git/2.6.2$ git version
git version 2.6.2
andy@AndyMacBookPro:/usr/local/Cellar/git/2.6.2$ which git
/usr/local/bin/git
andy@AndyMacBookPro:/usr/local/Cellar/git/2.6.2$ which gitk
/usr/local/bin/gitk
andy@AndyMacBookPro:/usr/local/Cellar/git/2.6.2$


可以看到目前我们osx中有两个git,而gitk也在/usr/local/bin/ 目录下。

参考:

http://stackoverflow.com/questions/17582685/install-gitk-on-mac
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: