报错
执行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-x3 tyrone.lin@ui.comadmin964 13 16:34 .
drwxr-xr-x4 tyrone.lin@ui.comadmin1284 14 11:31 ..
drwxr-xr-x12 tyrone.lin@ui.comadmin3844 14 11:44 .git
执行:
% git fetch --prune origin
% git pull --rebase origin master
From https://mirrors.ustc.edu.cn/homebrew-core
* branchmaster-> FETCH_HEAD
成功后执行
% brew update
Already up-to-date.
【brew|brew update 报错 "fatal: Could not resolve HEAD to a revision"】之后便可正常执行其他命令了
eg.
% brew install rbenv ruby-build