【问题标题】:Brew cannot find git, even though git in path (Mac/OSX)Brew 找不到 git,即使路径中有 git (Mac/OSX)
【发布时间】:2016-04-08 04:03:34
【问题描述】:

安装 brew 报告它找不到 git,并因错误而死。 Brew 似乎已安装(成功?)

> brew

(打印通常的帮助)

...但是brew doctor 不高兴:

这是我在运行 brew doctor 时得到的(当我按照 Homebrew 主页上的说明第一次安装 brew 时。)

> brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Git could not be found in your PATH.
Homebrew uses Git for several internal functions, and some formulae use Git
checkouts instead of stable tarballs. You may want to install Git:
  brew install git
Error: Git is unavailable
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core -q

我的路径:

> echo $PATH
/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Git 在这里:

> which git
/usr/bin/git

【问题讨论】:

  • 你检查过你的 git 版本是否 >= 一个 brew 需要的版本(如果有的话)
  • @pedrorijo91 它没有。
  • 请运行cd $(brew --prefix) && git fetch && git reset --hard origin/master,然后再次运行brew doctor
  • @bfontaine 谢谢,但没用:
  • @OlaVikholt 命令不起作用?或者他们工作但没有解决您的问题?

标签: git macos path command-line-interface homebrew


【解决方案1】:

你安装了命令行工具吗?

xcode-select --install

【讨论】:

  • 如果没有brew install 有效,这就是正确答案。
【解决方案2】:

Brew 可能适合您,您可以brew install 没有任何问题。

看起来brew doctor 更希望您使用 brew 安装 git,而不是使用 OSX 系统默认安装的 git

为了让brew doctor开心,运行:

> brew install git

这会将git 安装到/usr/local/bin/git 并可能使错误消失。

【讨论】:

  • 这实际上不起作用,因为你需要 git 来安装 brew 的 git!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-29
  • 2019-10-03
  • 2015-06-29
  • 1970-01-01
  • 2016-12-31
  • 2019-12-17
相关资源
最近更新 更多