git gitk:找不到命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30195143/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
gitk: command not found
提问by Coda Chang
Environment: Mac OSX 10.10. When I was trying to use gitk
, it shows:
环境:Mac OSX 10.10。当我尝试使用时gitk
,它显示:
Coda-2:~ Coda$ gitk
-bash: gitk: command not found
I think the reason is the old version of git
. Here is some information, and I have already typed brew update
.
我认为原因是旧版本的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
What is this message: it's just not linked
?
这是什么消息:it's just not linked
?
Furthermore, I check the path of git
:
此外,我检查了以下路径git
:
Coda-2:~ Coda$ which git
/usr/bin/git
It should be in /usr/bin/local/git
? How to fix it?
它应该在/usr/bin/local/git
?如何解决?
UPDATE
更新
I figure it out, thank @TimCastelijns.
我想通了,谢谢@TimCastelijns。
brew doctor
said:
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
So, I typed:
所以,我输入:
Coda-2:~ Coda$ brew link git
Linking /usr/local/Cellar/git/2.4.0... 220 symlinks created
Then I typed gitk
, and it worked and the path changed to /usr/local/bin/git
. However, when I want to check the version of git
. It still showed the old version, why?
然后我输入gitk
,它起作用了,路径更改为/usr/local/bin/git
. 但是,当我想检查git
. 它仍然显示旧版本,为什么?
Coda-2:~ Coda$ git --version
git version 1.9.3 (Apple Git-50)
回答by Coda Chang
First, check git
version.
首先,检查git
版本。
Type git --version
, and it may show old version.
键入git --version
,它可能会显示旧版本。
Next, update your Homebrew
接下来,更新您的 Homebrew
Type brew update
.
键入brew update
。
Then, download the latest version. brew install git
然后,下载最新版本。 brew install git
Note that, if it show Warning: git-2.4.0 already installed, it's just not linked
请注意,如果显示 Warning: git-2.4.0 already installed, it's just not linked
We can check brew doctor
, in my case, it told me to use brew link git
我们可以检查brew doctor
,就我而言,它告诉我使用brew link git
Finally, type brew install git
again and restart terminal.
最后,brew install git
再次输入并重新启动终端。
I can use gitk
and upgrade git version to the latest version.
我可以使用gitk
git 版本并将其升级到最新版本。
Update
更新
Since gitx
is no longer supported for OSX 10.12
, I recommend using Gitx-dev
由于gitx
不再支持OSX 10.12
,我建议使用Gitx-dev
回答by Clintm
I just installed the latest version of git via homebrew on macos.
我刚刚在 macos 上通过自制软件安装了最新版本的 git。
11:28 $ git --version
git version 2.25.0
It doesn't seem to have gitk and git gui so I noticed the answer for linux and tried to install the same package git-gui
via homebrew and it worked.
它似乎没有 gitk 和 git gui,所以我注意到了 linux 的答案,并尝试git-gui
通过自制软件安装相同的软件包并且它起作用了。
brew install git-gui
Found the bug here.
在这里找到了错误。
I'm running macos 10.14.5 Mojave.
我正在运行 macos 10.14.5 Mojave。
回答by mengxn
It's worked for me!
macOS Catalina 10.15.4
git version 2.26.0
它对我有用!
macOS Catalina 10.15.4
git 版本 2.26.0
# install git-gui
brew install git-gui
then, input gitk
in terminal, it's worked!
然后gitk
在终端输入,成功了!
回答by Shailen
Granted the OP is using Mac, a Linux user will find this link from Google and the accepted solution will not help.
如果 OP 使用的是 Mac,Linux 用户会从 Google 找到此链接,接受的解决方案将无济于事。
On Linux, use your favourite package manager and install git-gui
.
在 Linux 上,使用您最喜欢的包管理器并安装git-gui
.
On RedHat-based systems, ex CentOS, do:
在基于 RedHat 的系统上,例如 CentOS,请执行以下操作:
yum install -y git-gui
yum install -y git-gui
which will install the gitk
dependency.
这将安装gitk
依赖项。
Done.
完毕。