尝试酿造更新时出错

Error when trying to brew update

error: The last gc run reported the following. Please correct the root cause and remove .git/gc.log. Automatic cleanup will not be performed until the file is removed.

warning: There are too many unreachable loose objects; run 'git prune' to remove them.

brew 工作正常,他只在我更新他时显示此错误

也可以重新安装brew

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

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

如果你 运行 %> locate gc.log 你可能会在输出中看到类似这样的东西:

/usr/local/Library/Taps/caskroom/homebrew-versions/.git/gc.log

在这种情况下,为了解决问题,我去了 /usr/local/Library/Taps/caskroom 和 运行

%> git prune

%> rm /usr/local/Library/Taps/caskroom/homebrew-versions/.git/gc.log

问题消失了。

您可以通过 运行 两个命令解决此问题:

cd "$(brew --repo)" # Navigate to Homebrew's git repository
git prune && git gc # Remove loose objects

检查:

cd - # Go back to the original location
brew update

输出:

Already up-to-date.

错误应该已修复并消失! :)