如何修复Homebrew错误“fatal: early EOF”?

12

我正试图在MacOS Catalina上安装Homebrew。

在运行官方网页上的命令后,我得到了以下错误信息。

==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (9/9), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core` exited with 128.
Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.
Failed during: /usr/local/bin/brew update --force

你能手动克隆那个仓库吗? - bfontaine
9
我已经解决了。通过运行以下命令:git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1谢谢你的帮助!! - Vini Bettega
2个回答

2
我在使用 Mac M1 Big Sur 时遇到了同样的问题。
上面的评论非常有帮助。
步骤1:
sudo ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

步骤2:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

然后它失败了。
第三步:
cd /opt/homebrew/library/taps/homebrew 

步骤4:
sudo rmdir homebrew-core

步骤五:
git clone https://github.com/Homebrew/homebrew-core /opt/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

我也在浏览器上登录了Github,不确定那是否有影响。

我的情况下没有起作用,brew doctor仍然显示相同的错误。 - Rodrigo Lopez Guerra

0

我也遇到了同样的问题。幸运的是,上面的答案让我找对了方向。我只需要在第3、4和5步进行更改。

第1步

sudo ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

第2步

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

第3步

/usr/local/Homebrew/Library/Taps/homebrew

第4步

sudo rm -r homebrew-core

第5步

git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1


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