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

问题描述 投票:0回答:5

当我尝试更新(或升级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 作为防病毒软件。我尝试禁用它并运行上面的命令,但没有成功。任何帮助将不胜感激。

git macos homebrew fatal-error
5个回答
8
投票

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

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


4
投票

就我而言,只是跑步

brew doctor

解决所有问题为我解决了问题。我相信需要解决的两个重要问题是:

警告:您有不必要的本地木桶龙头。这可能会导致 安装最新木桶时出现问题。请通过运行删除它:
酿造 untap 自制啤酒/木桶

警告:您有不必要的本地核心水龙头!这可能会导致 安装最新公式时出现问题。请通过运行以下命令将其删除: 酿造 untap 自制/核心


2
投票

这件事今天发生在我身上(也在维珍媒体上)。使用 VPN 的另一种选择(特别是如果您不想付费的话)就是将您选择的 DNS 服务器更改为免费的公共服务器,例如 Google 的,如此处所述。太棒了;将它们设置为

8.8.4.4
8.8.8.8
之一或两者,命令应该可以工作。然后,您可以(如果您愿意)改回路由器的默认设置。


0
投票

寻找了很长时间的解决方案,有人说这是内存问题(事实并非如此)。只有上述评论帮助我解决了 Virgin Media wifi 问题,所以我改用移动数据。


0
投票

我有一台运行版本 10.13.6 (High Sierra) 的旧 MacBook Pro。我收到以下错误消息。

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!

sudo
运行以下命令,然后能够运行
brew update
。不过这个过程花了一段时间。

sudo git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
    Password:
    remote: Enumerating objects: 1828622, done.
    remote: Counting objects: 100% (1828478/1828478), done.
    remote: Compressing objects: 100% (524300/524300), done.
    remote: Total 1820693 (delta 1321938), reused 1791704 (delta 1293180), pack-reused 0 (from 0)
    Receiving objects: 100% (1820693/1820693), 633.85 MiB | 5.51 MiB/s, done.
    Resolving deltas: 100% (1321938/1321938), completed with 6487 local objects.
    From https://github.com/Homebrew/homebrew-core
       6befed7f8ca..c76a73e807c master     -> origin/master
© www.soinside.com 2019 - 2024. All rights reserved.