brew tap facebook/fb 导致获取错误
brew tap facebook/fb results in Fetching error
我尝试像往常一样更新 Homebrew。最近当我发出命令 brew update
时,出现以下错误:
Error: Fetching /usr/local/Homebrew/Library/Taps/facebook/homebrew-fb failed!
Tap 与我开发需要的软件 Buck
相关联。
我按照Buck官网的installation instruction进一步排查问题,再次下命令:
% brew tap facebook/fb
==> Unshallowing facebook/fb
fatal: couldn't find remote ref refs/heads/master
Error: Failure while executing; `git fetch --unshallow` exited with 128.
显然,Git 来源有问题。我尝试“重置”它:
% brew untap facebook/fb
Error: Refusing to untap facebook/fb because it contains the following installed formulae or casks:
buck
运气不好。我该如何解决这个问题?
此错误是 Facebook 将分支 master
重命名为 main
的结果。
要解决此问题,请先切换到 Homebrew 的本地 tap 文件夹:
cd /usr/local/Homebrew/Library/Taps/facebook/homebrew-fb
然后,运行以下Git命令更新本地仓库:
git branch --unset-upstream
git config remote.origin.fetch '+refs/heads/main:refs/remotes/origin/main'
git fetch --prune origin
git branch -m main
git branch -u origin/main
git remote set-head origin -a
最后,删除不再需要的 master
ref(可选):
rm .git/refs/remotes/origin/master
就是这样,您现在应该可以成功 运行 brew update
.
我尝试像往常一样更新 Homebrew。最近当我发出命令 brew update
时,出现以下错误:
Error: Fetching /usr/local/Homebrew/Library/Taps/facebook/homebrew-fb failed!
Tap 与我开发需要的软件 Buck
相关联。
我按照Buck官网的installation instruction进一步排查问题,再次下命令:
% brew tap facebook/fb
==> Unshallowing facebook/fb
fatal: couldn't find remote ref refs/heads/master
Error: Failure while executing; `git fetch --unshallow` exited with 128.
显然,Git 来源有问题。我尝试“重置”它:
% brew untap facebook/fb
Error: Refusing to untap facebook/fb because it contains the following installed formulae or casks:
buck
运气不好。我该如何解决这个问题?
此错误是 Facebook 将分支 master
重命名为 main
的结果。
要解决此问题,请先切换到 Homebrew 的本地 tap 文件夹:
cd /usr/local/Homebrew/Library/Taps/facebook/homebrew-fb
然后,运行以下Git命令更新本地仓库:
git branch --unset-upstream
git config remote.origin.fetch '+refs/heads/main:refs/remotes/origin/main'
git fetch --prune origin
git branch -m main
git branch -u origin/main
git remote set-head origin -a
最后,删除不再需要的 master
ref(可选):
rm .git/refs/remotes/origin/master
就是这样,您现在应该可以成功 运行 brew update
.