在Mac上更新Homebrew失败

8
在执行 brew update 命令时,我收到以下错误提示:
fatal: Unable to find remote helper for 'https'
Error: Fetching /usr/local failed!
fatal: Unable to find remote helper for 'https'
Error: Fetching /usr/local/Library/Taps/caskroom/homebrew-cask failed!
Already up-to-date.

如果您运行brew install git,然后再尝试一次,它是否有效? - bfontaine
这似乎解决了问题,谢谢bfontaine! - Suraj Sharma
不用谢;我把这个作为答案添加了,这样问题就可以标记为已解决。 - bfontaine
4个回答

8

您遇到了 git 安装的问题;您可以通过执行以下命令更新到最新版本来解决此问题:

brew install git

这帮助我让事情正常运转。请注意,我在此之后不止一次地执行了 brew update - lindes
这对我的机器没有影响。我的问题可能是由于 Monterey 升级引起的。 - Brent Fisher

2
以下解决方案适用于我,但不是我的。
我在brew的github讨论中找到了它。

您的SSH设置存在问题。

您似乎正在将https://github.com/重写为git@github.com:,正如最后一次输出所示。

请检查您的~/.gitconfig是否有类似于insteadOf = https://github.com/的行,这是您必须在某个时候添加(或某个工具为您添加)到您的配置中的。

请通过在该行前加上#注释掉该行并重试。


2

我也遇到了这个问题,对我来说是因为相关的存储库是通过ssh进行克隆的,而我的私钥受到密码保护。要解决这个问题,我使用了ssh-agent

eval `ssh-agent`

ssh-add

在我添加了我的密钥并输入了密码后,brew update 成功了。


0
这是因为brew指向了一个非标准的github源。使用以下命令将brew指向正确的github URL。

git -C "/usr/local/Homebrew" remote set-url origin https://github.com/Homebrew/brew

完成后运行brew update。

1
我的尝试仍然失败了。 - Brent Fisher

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接