当前位置: 首页 > 工具软件 > xcash-core > 使用案例 >

Mac homebrew报错Error: homebrew-core is a shallow clone.

易元青
2023-12-01

Mac homebrew报错Error: homebrew-core is a shallow clone.

解决方法

删除homebrew-core后更新即可

cd /usr/local/Homebrew/Library/Taps/homebrew
rm -rf homebrew-core
brew upgrade

使用brew upgrade后会重新更新homebrew-core

问题解析

Mac更新完系统后使用homebrew就报错:

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 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!

链接: 参考

又出现问题了!!
当使用brew upgrade更新时出现如下错误提示:

Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
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.

问题解决

终端输入该语句,来代替brew upgrade
输入该语句的目录是/usr/local/Homebrew/Library/Taps/homebrew
注意:因为删掉了homebrew目录下homebrew-core,所以再新建一个该目录,mkdir homebrew 然后再输入如下语句

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

成功后出现如下代码

Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 5748, done.
remote: Counting objects: 100% (5748/5748), done.
remote: Compressing objects: 100% (5507/5507), done.
remote: Total 5748 (delta 52), reused 380 (delta 17), pack-reused 0
Receiving objects: 100% (5748/5748), 5.24 MiB | 57.00 KiB/s, done.
Resolving deltas: 100% (52/52), done.

验证brew是否下载成功

重开一个终端输入 brew,出现如下代码说明已成功!

Example usage:
  brew search [TEXT|/REGEX/]
  brew info [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]

Troubleshooting:
  brew config
  brew doctor
  brew install --verbose --debug FORMULA

Contributing:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]

Further help:
  brew commands
  brew help [COMMAND]
  man brew
  https://docs.brew.sh

走到这里可太不容易了!终于在mac 中下载好 brew~~
开始用brew 更新软件啦 开心开心~~

 类似资料: