Homebrew 致命:需要一次修订(MacOs Sierra) [英] Homebrew fatal: needed a single revision (MacOs Sierra)
问题描述
不确定这个问题是否与升级到 MacOs Sierra 有关,但从那一刻起,当我运行 'brew update' 时会发生这个错误
Not sure if this problem is related to upgrading to MacOs Sierra, but since that moment this error occurs when I run '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 后我遇到了同样的问题.
I had the same problem after upgrading to Sierra.
除了显示 Homebrew 安装路径的 brew --prefix
之外,还有 brew --repository
,它显示 .git
目录所在.
In addition to brew --prefix
, which displays Homebrew’s install path, there’s also brew --repository
, which displays where it’s .git
directory is located.
man brew
声称对于标准安装,前缀和存储库是同一目录".手册页已过时或我的安装不是标准",但我的 prefix
是 /usr/local
和我的 repository
是 /usr/local/Homebrew
.
man brew
says that claims that "for standard installs, the prefix and repository are the same directory". Either the man page is out of date or my install isn’t "standard", but my prefix
is /usr/local
and my repository
is /usr/local/Homebrew
.
使用相同的命令但使用 cd $(brew --repository)
对我有用:
Using the same command but with cd $(brew --repository)
worked for me:
cd $(brew --repository) && git fetch && git reset --hard origin/master
这篇关于Homebrew 致命:需要一次修订(MacOs Sierra)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!