brew update reports “fatal: Could not resolve HEAD to a revision”
When executing the brew update command:
% brew update
error: Not a valid ref: refs/remotes/origin/master
fatal: Could not resolve HEAD to a revision
Already up-to-date.
resolve
% 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
Open the error path:
% cd /opt/homebrew/Library/Taps/homebrew/homebrew-core
% ls -al
total 0
drwxr-xr-x 3 [email protected] admin 96 4 13 16:34 .
drwxr-xr-x 4 [email protected] admin 128 4 14 11:31 ..
drwxr-xr-x 12 [email protected] admin 384 4 14 11:44 .git
implement:
% git fetch --prune origin
% git pull --rebase origin master
From https://mirrors.ustc.edu.cn/homebrew-core
* branch master -> FETCH_HEAD
Execute after success
% brew update
Already up-to-date.
Then you can execute other commands normally
eg. % brew install rbenv ruby-build
Similar Posts:
- How to Solve Error using brew install opencv in MAC
- MAC Install hombrew error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
- chown: /usr/local: Operation not permitted [Solved]
- Git Unable to switch remote branches error: pathspec ‘origin/XXXX’ did not match any file(s) known to git
- How to Solve Error: parent directory is world writable but not sticky
- [Solved] Mac Install brew Error: “Warning: /opt/homebrew/bin is not in your PATH.”
- MAC Install homebrew Error: Failed to connect to raw.githubusercontent.com port 443: Connection refused error:
- Homebrew | curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
- Git Error: nothing to commit, working directory clean [How to Solve]
- How to Solve Error Permission denied when running brew cleanup