不确定此问题是否与升级到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
答案 0 :(得分:59)
升级到Sierra后我遇到了同样的问题。
除了显示Homebrew安装路径的brew --prefix
之外,还有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
答案 1 :(得分:2)
接受的答案对我没有用。有用的是卸载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
答案 2 :(得分:0)
没有什么对我有用,我不得不求助于卸载并重新安装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)"
答案 3 :(得分:0)
卸载
while True:
try:
with open('file.csv') as csvDataFile:
csvReader = csv.reader(csvDataFile)
for row in csvReader:
url.append(row[1])
if url[1] == "WAIT":
time.sleep(0.1)
else:
break
except Exception as e:
print(e)
continue
然后重新安装。