git 在 Mac 上安装 gitk
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17582685/
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
Install gitk on Mac
提问by Mingyu
Does anyone know how to install gitk on Mac?
有谁知道如何在 Mac 上安装 gitk?
From their official website, it seems gitk comes with git, but the version of my git (git version 1.7.12.4 (Apple Git-37)
) does not come with gitk.
从他们官网看,gitk好像是自带git的,但是我的git( git version 1.7.12.4 (Apple Git-37)
)版本没有gitk。
brew install gitk
does not work for gitk.
brew install gitk
不适用于 gitk。
Version info (copied from comments):
版本信息(从评论中复制):
- OS X 10.8.2 (12C2034) "Mountain Lion"
- XCode Version 4.6 (4H127)
- OS X 10.8.2 (12C2034)“山狮”
- XCode 4.6 版 (4H127)
回答by Jenna Pederson
Correct, the 1.7.12.4 (Apple Git-37) does not come with gitk. You can install a more recent version of git + git-ui as a separate formula by using brew. More thorough instructions located here: http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/(see this commit extracting git-gui/gitk into its own formula: https://github.com/Homebrew/homebrew-core/commit/dfa3ccf1e7d3901e371b5140b935839ba9d8b706)
正确,1.7.12.4 (Apple Git-37) 没有附带 gitk。您可以使用 brew 将更新版本的 git + git-ui 作为单独的公式安装。更详尽的说明位于此处:http: //www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/(请参阅此提交将 git-gui/gitk 提取到自己的公式中: https://github.com/Homebrew/homebrew-core/commit/dfa3ccf1e7d3901e371b5140b935839ba9d8b706)
Run the following commands at the terminal:
在终端运行以下命令:
brew update
brew install git
brew install git-gui
If you get an error indicating it could not link git, then you may need to change permissions/owners of the files it mentions.
如果您收到一个错误,表明它无法链接 git,那么您可能需要更改它提到的文件的权限/所有者。
Once completed, run:
完成后,运行:
type -a git
And make sure it shows:
并确保它显示:
/usr/local/bin/git
If it does not, run:
如果没有,请运行:
brew doctor
And make the path change to put /usr/local/bin earlier in the path. Now, gitk should be on your path (along with an updated version of git).
并更改路径以将 /usr/local/bin 放在路径中的较早位置。现在,gitk 应该在您的路径上(以及 git 的更新版本)。
回答by Leo
I just had the same problem and solved it as follows:
我刚刚遇到了同样的问题,并按如下方式解决了它:
- Download the official git package for Mac from http://git-scm.com/download/mac
- Install the package. This places all the binaries in /usr/local/git/bin.
- Optionally run the included script to make gitk accessible outside of terminals
- Either add /usr/local/git/bin to your PATH or use an alias (
alias gitk='/usr/local/git/bin/gitk'
)
- 从http://git-scm.com/download/mac下载 Mac 的官方 git 包
- 安装软件包。这会将所有二进制文件放在 /usr/local/git/bin 中。
- (可选)运行包含的脚本以使 gitk 可以在终端之外访问
- 将 /usr/local/git/bin 添加到您的 PATH 或使用别名 (
alias gitk='/usr/local/git/bin/gitk'
)
回答by aris
If you already have git installed via homebrew, you can just do upgrade:
如果您已经通过自制软件安装了 git,则可以进行升级:
$ type -a git
/usr/bin/git
$ brew upgrade git
$ type -a git
/usr/local/bin/git
The one at local/bin will have gitk
本地/bin 上的那个将有 gitk
回答by Abhi
I had the same issue. I installed gitx instead.
我遇到过同样的问题。我安装了gitx。
You can install gitx from here.
你可以从这里安装 gitx。
Download the package and install it. After that open the gitk from spotlight search, goto the top left corner. Click on GitX and enable the terminal usage.
下载软件包并安装它。之后从聚光灯搜索中打开 gitk,转到左上角。点击 GitX 并启用终端使用。
Goto your repo and simply type:
转到您的仓库并简单地输入:
$ gitx --all
It will open the Gui.
它将打开 Gui。
User manual: http://gitx.frim.nl/user_manual.html
回答by Lionel M
Git Mac version comes without gitk
but if you do
brew install git
you get instant access to gitk
.
Git Mac 版本没有,gitk
但如果你有,
brew install git
你可以立即访问gitk
.
I'm using MAC sierra 10.12.5
我使用的是 MAC sierra 10.12.5
Edit: This doesn′t work anymore, you must install brew install git-gui
编辑:这不再起作用,您必须安装 brew install git-gui
回答by DDM
There are two ways to fix this:
有两种方法可以解决这个问题:
- Unix Way
- Homebrew Way
- Unix方式
- 家酿方式
1. Unix Way:
1.Unix方式:
Four simple steps
四个简单的步骤
- Execute
which git
in the terminal to know the location of yourgit
executable. Open that directory & locategitk
inside thebin
folder. Copy the path --- typically/usr/local/git/bin
- Create
bash_profile
if you don't have already. Edit your~/.bash_profile
to add the location of localgit
&gitk
in the paths. Or, simply copy-pasta from the sample written below. - NOTE: This step is relevant if you're using El Capitan or higher& if you get an unknown color name “lime” error--- Open the
gitk
file from the location/usr/local/bin/gitk
in a text editor. Find all mentions oflime
in the file, and replace with"#99FF00"
. Take a backup before doing so. - Reload bash:
source ~/.bash_profile
& rungitk
which git
在终端中执行以了解git
可执行文件的位置。打开该目录并gitk
在bin
文件夹内找到。复制路径 --- 通常/usr/local/git/bin
bash_profile
如果您还没有,请创建。编辑您~/.bash_profile
以在路径中添加 localgit
&的位置gitk
。或者,只需从下面写的示例中复制意大利面。- 注意:如果您使用 El Capitan 或更高版本并且遇到未知颜色名称“lime”错误,则此步骤是相关的---
gitk
从/usr/local/bin/gitk
文本编辑器中的位置打开文件。查找lime
文件中所有提及的,并替换为"#99FF00"
。在这样做之前进行备份。 - 重新加载 bash:
source ~/.bash_profile
& 运行gitk
Sample bash_profile
:
样品bash_profile
:
# enabling gitk
export PATH=/usr/local/git/bin:$PATH
2. HomeBrew way
2.自制方式
Caution- Most of the steps below probably require sudo
privileges.
注意- 下面的大多数步骤可能需要sudo
特权。
brew update
brew doctor
brew link git
- added
/usr/local/Cellar/git/2.4.0/bin
to path & then reload bash & rungitk
- No luck yet? Proceed further.
- Run
which git
& observe if git is still linked to/usr/bin/git
- If yes, then open the directory & locate the was a binary executable.
- Take its backup, may be save with a name git.bak& delete the original file
- Reload the terminal -
source ~/.bash_profile
brew update
brew doctor
brew link git
- 添加
/usr/local/Cellar/git/2.4.0/bin
到路径 & 然后重新加载 bash & 运行gitk
- 还没有运气?进一步行动。
- 运行
which git
并观察 git 是否仍然链接到/usr/bin/git
- 如果是,则打开目录并找到二进制可执行文件。
- 取它的备份,可以用名称git.bak保存并删除原始文件
- 重新加载终端 -
source ~/.bash_profile
回答by twm
If you happen to already have Fink installed, this worked for me on Yosemite / OS X 10.10.5:
如果您碰巧已经安装了 Fink,这在 Yosemite / OS X 10.10.5 上对我有用:
fink install git
fink install git
Note that as a side effect, other git commands are also using the newer git version (2.5.1) installed by Fink, rather than the version from Apple (2.3.2), which is still there but preempted by my $PATH.
请注意,作为副作用,其他 git 命令也使用 Fink 安装的较新的 git 版本 (2.5.1),而不是来自 Apple 的版本 (2.3.2),后者仍然存在,但被我的 $PATH 抢占。
回答by justin
What I ended up doing was: brew info git
我最终做的是: brew info git
Which gave me info that git was cloned into: /usr/local/Cellar/git/1.9.0
这给了我 git 被克隆到的信息:/usr/local/Cellar/git/1.9.0
So I just added: /usr/local/Cellar/git/1.9.0/bin to the beginning of my PATH env variable.
所以我只是将: /usr/local/Cellar/git/1.9.0/bin 添加到我的 PATH 环境变量的开头。
Note: I don't know how to use homebrew... just want to get going quickly as I have other things to do... this basically gets gitk running for me so I'm sticking to it for now. (probably not the way to work with homebrew though).
注意:我不知道如何使用自制软件......只是想快速开始,因为我还有其他事情要做......这基本上让 gitk 为我运行,所以我现在坚持使用它。(虽然可能不是使用自制软件的方式)。
回答by chrish
You can also get gitk
with the git
from MacPorts.
您还可以gitk
用git
从MacPorts的。
sudo port install git
回答by Stuart Berg
For Mojave users, I found this page very useful, particularly this suggestion:
对于 Mojave 用户,我发现这个页面非常有用,特别是这个建议:
/usr/bin/wish $(which gitk)
...without that, the window did not display correctly!
...没有那个,窗口不能正确显示!