Big Sur 更新 brew 踩坑

升级big sur 后,执行 brew update 时会有如下提示:

  homebrew-core is a shallow clone.
  homebrew-cask is a shallow clone.
To `brew update`, first run:
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
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: dumb http transport does not support shallow capabilities,

进入到 /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core 目录下
此时通过执行 git remote -v 发现之前将 brew 换成了 阿里源,最终换成默认仓库解决问题

默认的仓库地址:

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask"
git remote set-url origin https://github.com/Homebrew/homebrew-cask.git

不知什么原因,fetch homebrew-core 那一步还是失败,最后索性删掉 homebrew-core 目录 从新 clone 一份,至此,brew update 终于可以正常更新了

git clone https://github.com/Homebrew/homebrew-core.gitunshallow

类似文章

5条评论

回复 z 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注