brew update 报错 “fatal: Could not resolve HEAD to a revision“

报错

执行brew update命令时:

% brew update
error: Not a valid ref: refs/remotes/origin/master
fatal: Could not resolve HEAD to a revision
Already up-to-date.

解决

% brew update --verbose

% brew update -verbose
Checking if we need to fetch /opt/homebrew...
Checking if we need to fetch /opt/homebrew/Library/Taps/homebrew/homebrew-cask...
Fetching /opt/homebrew...
Checking if we need to fetch /opt/homebrew/Library/Taps/homebrew/homebrew-core...
Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-core...
Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-cask...
fatal: unable to access 'https://github.com/Homebrew/homebrew-cask/': Failed to connect to github.com port 443: Operation timed out
Error: Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-cask failed!
Updating /opt/homebrew...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Switched to and reset branch 'master'
Your branch is up to date with 'origin/master'.
Switched to and reset branch 'stable'
Current branch stable is up to date.

Updating /opt/homebrew/Library/Taps/homebrew/homebrew-core...
fatal: Could not resolve HEAD to a revision

打开报错路径:
% cd /opt/homebrew/Library/Taps/homebrew/homebrew-core
% ls -al

total 0
drwxr-xr-x   3 tyrone.lin@ui.com  admin   96  4 13 16:34 .
drwxr-xr-x   4 tyrone.lin@ui.com  admin  128  4 14 11:31 ..
drwxr-xr-x  12 tyrone.lin@ui.com  admin  384  4 14 11:44 .git

执行:
% git fetch --prune origin
% git pull --rebase origin master

From https://mirrors.ustc.edu.cn/homebrew-core
 * branch                  master     -> FETCH_HEAD

成功后执行% brew update

Already up-to-date.

之后便可正常执行其他命令了
eg. % brew install rbenv ruby-build



作者:fall1n
链接:https://www.jianshu.com/p/b2de788c3c6d
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

悟V-SpHeNIC

支持科研技术

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值