Homebrew 更新失败:致命:协议错误:git fetch 上的包头错误

时间:2021-03-10 08:53:12

标签: git macos homebrew fatal-error

当我尝试更新(或升级 brew)时,出现以下错误:

#> brew update
Error:
  homebrew-core is a shallow clone.
To `brew update`, first run:
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
This command may take a few minutes to run due to the large size of the repository.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!

当我运行指定的命令时,我收到另一个错误:

#> git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
fatal: protocol error: bad pack header

我使用的是 macOS Big Sur V11.2.3。我有 BitDefender 作为防病毒软件。我尝试禁用它并运行上面的命令,但没有运气。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:4)

我发现一些页面表明这是由我的 ISP(英国的 Virgin Media)启用的“防病毒”软件设置引起的。我在 https://my.virginmedia.com/my-apps/onlinesecurity/websafe/settings 关闭了“病毒安全”,但这并没有解决我的问题。

然后,我打开了我的 VPN (NordVPN),导致问题的 brew 命令起作用了。