Brew无法找到git,即使git in path(Mac / OSX)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Brew无法找到git,即使git in path(Mac / OSX)相关的知识,希望对你有一定的参考价值。

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

> brew

(打印常用的帮助)

...但brew doctor不高兴:

这就是我运行brew医生时所得到的(当我第一次按照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
答案

你安装了命令行工具吗?

xcode-select --install
另一答案

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

看起来像brew doctor更喜欢你用brew安装git而不是使用OSX系统默认安装的git

为了使brew doctor高兴,运行:

> brew install git

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

以上是关于Brew无法找到git,即使git in path(Mac / OSX)的主要内容,如果未能解决你的问题,请参考以下文章

mac 使用brew安装提示fatal: not in a git directory Error: Command failed with exit 128: git

错误:无法在 Windows cmd 的 PATH 中找到 git

错误:无法找到实用程序“git”,无法找到开发人员工具或PATH

Mac 中的 brew install git 错误:无法符号链接 share/man/man5/gitattributes.5

Bower : ENOGIT git is not installed or not in the PATH

VSCode 通知:未找到Git。请安装Git,或在“git.path”设置中配置