brew工具-“fatal: Could not resolve HEAD to a revision”错误解决

淩亂°似流年 2023-09-28 09:41 126阅读 0赞

问题描述:

在进行brew update时,发生错误,如下:

% brew update

fatal: Could not resolve HEAD to a revision

Already up-to-date.

解决办法:

思路:

1)找到出错的homebrew的目录;

2) 进入到该目录,执行fetch 和 pull命令。

1)运行“brew update —verbose”,找到出错的homebrew的目录:

% brew update —verbose

Checking if we need to fetch /usr/local/Homebrew…

Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask…

Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core…

Fetching /usr/local/Homebrew…

Updating /usr/local/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 /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core…

fatal: Could not resolve HEAD to a revision

Already up-to-date.

2)进入到出错的目录,然后先fetch,后pull,如下:

cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core

% pwd

/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core

% git fetch —prune origin

% git pull —rebase origin master

From https://github.com/Homebrew/homebrew-core

* branch master -> FETCH_HEAD

Updating files: 100% (6435/6435), done.

如下图:

" class="reference-link">647037581fa94983858768d84677db91.png


发表评论

表情:
评论列表 (有 0 条评论,126人围观)

还没有评论,来说两句吧...

相关阅读