自制致命:只需要一个版本(MacOs Sierra)



不确定此问题是否与升级到MacOs Sierra有关,但从那一刻起,当我运行'brew update'时出现此错误

→ brew update
Checking out v1.0.0 in /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask...
To checkout master in /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask run:
  'cd /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask && git checkout master
fatal: Cannot update paths and switch to branch 'v1.0.0' at the same time.
Did you intend to checkout 'refs/tags/1.0.0' which can not be resolved as commit?
fatal: Needed a single revision
invalid upstream refs/tags/1.0.0
Checking out v1.0.0 in /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart...
To checkout master in /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart run:
  'cd /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart && git checkout master
fatal: Cannot update paths and switch to branch 'v1.0.0' at the same time.
Did you intend to checkout 'refs/tags/1.0.0' which can not be resolved as commit?
fatal: Needed a single revision
invalid upstream refs/tags/1.0.0
Checking out v1.0.0 in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
To checkout master in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core run:
  'cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core && git checkout master
fatal: Cannot update paths and switch to branch 'v1.0.0' at the same time.
Did you intend to checkout 'refs/tags/1.0.0' which can not be resolved as commit?
fatal: Needed a single revision
invalid upstream refs/tags/1.0.0

我试着运行

cd $(brew --prefix) && git fetch && git reset --hard origin/master

但是它给了我这个错误:

fatal: Not a git repository (or any of the parent directories): .git

我在升级到Sierra后也遇到了同样的问题。

除了brew --prefix,显示Homebrew的安装路径,还有brew --repository,显示.git目录所在的位置。

man brew表示声明"对于标准安装,前缀和存储库是相同的目录"。手册页过期或我的安装不是"标准",但我的prefix/usr/local,我的repository/usr/local/Homebrew

使用相同的命令,但cd $(brew --repository)为我工作:

cd $(brew --repository) && git fetch && git reset --hard origin/master

接受的答案对我不起作用。什么工作是卸载homebrew并重新安装:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew analytics off

这个命令为我修复了错误:

git -C $(brew --repository homebrew/core) checkout master

对我来说没什么用,我不得不卸载并重新安装Brew:

# change to home directory to avoid other errors later
cd ~
# uninstall brew
rm -rf /usr/local/Cellar /usr/local/.git && cd ~ && brew cleanup
 # reinstall brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

卸载


/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

和重新安装

相关内容

  • 没有找到相关文章

最新更新