web-dev-qa-db-fra.com

Homebrew fatal: besoin d'une seule révision (MacOs Sierra)

Je ne sais pas si ce problème est lié à la mise à niveau vers MacOs Sierra, mais depuis ce moment, cette erreur se produit lorsque j'exécute "mise à jour de brassage"

→ 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

J'ai essayé de courir

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

Mais cela me donne cette erreur:

fatal: Not a git repository (or any of the parent directories): .git
30
Martin van Houte

J'ai eu le même problème après la mise à niveau vers Sierra.

En plus de brew --prefix, Qui affiche le chemin d'installation de Homebrew, il y a aussi brew --repository, Qui indique où se trouve le répertoire .git.

man brew Indique que "pour les installations standard, le préfixe et le référentiel sont le même répertoire". Soit la page de manuel est obsolète, soit mon installation n'est pas "standard", mais mon prefix est /usr/local Et mon repository est /usr/local/Homebrew.

Utiliser la même commande mais avec cd $(brew --repository) a fonctionné pour moi:

cd $(brew --repository) && git fetch && git reset --hard Origin/master
59
thomasd

La réponse acceptée n'a pas fonctionné pour moi. Ce qui a fonctionné a été de désinstaller homebrew et de le réinstaller:

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
herrtim

Rien ne fonctionnait vraiment pour moi, j'ai dû recourir à la désinstallation et à la réinstallation de 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)"
0
a20