Homebrew 更新时遇到问题Error Fetching Homebrew failed解决方法

1.输入命令brew cleanup && brew update,更新Homebrew,出现Error: Fetching /usr/local/Homebrew failed! fatal: Could not resolve HEAD to a revision这个原因是因为源不通,代码来不下来

 chenxx@MEIZU-16s-Pro  /usr/local/Homebrew   stable 3.3.7  brew cleanup && brew update                               ✔  365  12:43:06
Error: Fetching /usr/local/Homebrew failed!
fatal: Could not resolve HEAD to a revision

2.查看问题:

 chenxxx@MEIZU-16s-Pro  /usr/local/Homebrew/Library/Taps/homebrew   stable 3.3.7  ls -all                             ✔  370  12:48:58
total 0
drwxr-xr-x   4 chenlintao  admin  128 12  6 17:25 .
drwxr-xr-x   3 chenlintao  admin   96 12  6 16:32 ..
drwxr-xr-x  17 chenlintao  admin  544 12  6 17:26 homebrew-cask
drwxr-xr-x   3 chenlintao  admin   96 12  6 16:32 homebrew-core
 chenxxx@MEIZU-16s-Pro  /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core   master  ls -all                     ✔  368  12:48:41
total 0
drwxr-xr-x   3 chenlintao  admin   96 12  6 16:32 .
drwxr-xr-x   4 chenlintao  admin  128 12  6 17:25 ..
drwxr-xr-x  11 chenlintao  admin  352 12  7 12:43 .git

homebrew-core文件夹有问题。

3.针对上述问题,解决方法就是更换国内镜像源,及更改为中科大的国内镜像,同时把homebrew-core的镜像地址也设为中科大的国内镜像。

依次执行:

git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

cd "$(brew --repo)"

git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" 

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

执行上述之后,再执行brew update即可成功更新。

 chenxxx@MEIZU-16s-Pro  /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core   master  brew update                 ✔  390  12:58:08
Updated 1 tap (homebrew/cask).
==> Updated Casks
metasploit

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值