gitk:找不到命令

Cod*_*ang 19 git gitk

环境:Mac OSX 10.10.当我尝试使用时gitk,它显示:

Coda-2:~ Coda$ gitk
-bash: gitk: command not found
Run Code Online (Sandbox Code Playgroud)

我认为原因是旧版本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
Run Code Online (Sandbox Code Playgroud)

这是什么信息:it's just not linked

此外,我检查路径git:

Coda-2:~ Coda$ which git
/usr/bin/git
Run Code Online (Sandbox Code Playgroud)

它应该在/usr/bin/local/git?怎么解决?

UPDATE

我明白了,谢谢@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
Run Code Online (Sandbox Code Playgroud)

所以,我键入:

Coda-2:~ Coda$ brew link git
Linking /usr/local/Cellar/git/2.4.0... 220 symlinks created
Run Code Online (Sandbox Code Playgroud)

然后我打字gitk,它工作,路径改为/usr/local/bin/git.但是,当我想检查版本时git.它仍然显示旧版本,为什么?

Coda-2:~ Coda$ git --version
git version 1.9.3 (Apple Git-50)
Run Code Online (Sandbox Code Playgroud)

Cli*_*ntm 59

我刚刚在 macos 上通过自制软件安装了最新版本的 git。

11:28 $ git --version
git version 2.25.0
Run Code Online (Sandbox Code Playgroud)

它似乎没有 gitk 和 git gui,所以我注意到了 linux 的答案,并尝试git-gui通过自制软件安装相同的软件包并且它起作用了。

brew install git-gui
Run Code Online (Sandbox Code Playgroud)

这里找到了错误。

我正在运行 macos 10.14.5 Mojave。

  • 这是有道理的,git 似乎不再将 gitk 包含在标准包中。 (3认同)
  • 如果您花点时间阅读一下,现在甚至在`brew install git`(或`brew info git`)之后的警告中提到了:```来自:https://github.com/Homebrew/homebrew-core/blob /master/Formula/git.rb ==> 所需依赖项:gettext ✔、pcre2 ✔ ==> 选项 --HEAD 安装 HEAD 版本 ==> 警告 Tcl/Tk GUI(例如 gitk、git-gui)现在位于`git-gui` 公式。``` (2认同)

Cod*_*ang 44

首先,检查git版本.

键入git --version,它可能会显示旧版本.

接下来,更新您的 Homebrew

类型brew update.

然后,下载最新版本. brew install git

请注意,如果显示 Warning: git-2.4.0 already installed, it's just not linked

brew doctor在我的情况下,我们可以检查它告诉我使用brew link git

最后,brew install git再次键入并重新启动终端.

我可以使用gitkgit版本升级到最新版本.

更新

由于gitx不再支持OSX 10.12,我建议使用Gitx-dev

  • 很好的答案,但你不应该使用brew与sudo. (5认同)

Sha*_*len 5

假设 OP 使用 Mac,Linux 用户会从 Google 找到此链接,而接受的解决方案将无济于事。

在 Linux 上,使用您最喜欢的包管理器并安装git-gui.

在基于 RedHat 的系统(例如 CentOS)上,执行以下操作:

yum install -y git-gui

这将安装gitk依赖项。

完毕。