在使用自制软件安装git时遇到问题。尝试过每一个可用的解决方案。我对/ usr / local有写权限。我可以毫无问题地酿造更新和酿造医生,但它说我已经安装了git-git(无论是什么)。我有哦-my-zsh shell。我有安装git和atom的xcode,如果这可能是相关的。
Last login: Tue Feb 24 09:56:18 on console
You have new mail.
# user at mymac in ~ [9:57:48]
$ brew install git
Error: git-git already installed
To install this version, first `brew unlink git'
# user at mymac in ~ [9:57:54]
$ brew unlink git
Error: No such keg: /usr/local/Cellar/git
# user at mymac in ~ [9:58:04]
$ brew update
Updated Homebrew from b33e8a75 to cf5325ac.
==> New Formulae
deisctl gcovr pdf-redact-tools
==> Updated Formulae
activemq couchdb-lucene hamsterdb libgadu redpen
avian datomic httpie libmpdclient unittest
berkeley-db gtk-gnutella ice mysql
cctools h2o ipsumdump mysql-cluster
# user at mymac in ~ [10:01:04]
$ brew doctor
Your system is ready to brew.
# user at mymac in ~ [10:01:25]
$ brew install git
Error: git-git already installed
To install this version, first `brew unlink git'
# user at mymac in ~ [10:01:30]
$ brew unlink git
Error: No such keg: /usr/local/Cellar/git
# user at mymac in ~ [10:01:35]
$ brew link git
Error: No such keg: /usr/local/Cellar/git
# user at mymac in ~ [10:01:44]
$ git --version
zsh: command not found: git
# user at mymac in ~ [10:02:01]
$ brew --version
0.9.5
# user at mymac in ~ [10:06:17]
$ git-git --version
zsh: command not found: git-git
# user at mymac in ~ [10:11:32]
$ which git-git
git-git not found
更新:我尝试将shell更改为bash。同样的问题。
mymac:~ user$ git --version
-bash: git: command not found
mymac:~ user$ brew install git
Error: git-git already installed To install this version, first `brew unlink git'
mymac:~ user$ –
忘了提我正在使用优胜美地10.10.2
答案 0 :(得分:1)
从命令行执行
where git
您可能会获得两个位置
/usr/bin/git
/usr/local/bin/git
然后做
/usr/bin/git --version
你应该得到
git version 2.5.4 (Apple Git-61)
这是Mac OS附带的已安装版本
然后检查此路径上的版本
/usr/local/bin/git --version
git version 2.7.1
这是当前版本
然后检查你的路径
echo $PATH
并确保'/ usr / local / bin /'在您的路径中尽早,否则它将不会执行git命令,如果不编辑您的路径。