当前位置:   article > 正文

brew update 更新时报错_to `brew update`, first run:

to `brew update`, first run:

在 mac 下执行 brew update 时,报如下错误:

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

提示执行如下命令:

  1. git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
  2. git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow

但试了几次都没有成功,报错如下:

  1. git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
  2. remote: Enumerating objects: 365476, done.
  3. remote: Counting objects: 100% (365455/365455), done.
  4. remote: Compressing objects: 100% (147319/147319), done.
  5. fatal: The remote end hung up unexpectedly12 MiB | 9.00 KiB/s
  6. fatal: early EOF
  7. fatal: index-pack failed

需要换到国内的镜像,执行如下命令:

  1. ## 更新 homebrew-cask(如果提示 No such file or directory 可以先跳过前三个命令)
  2. cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
  3. # 更换源
  4. git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
  5. # 更新
  6. git fetch --unshallow
  7. ## 更新 homebrew-core
  8. cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-core
  9. # 更换源
  10. git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
  11. # 更新
  12. git fetch --unshallow

常用的国内镜像有(上面的不行就多试几个):

  1. https://mirrors.ustc.edu.cn/homebrew-core.git
  2. https://mirrors.aliyun.com/homebrew/homebrew-core.git
  3. https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

再执行brew update就可以了。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/760575
推荐阅读