Homebrew fatal: necesitaba una única revisión (macOS Sierra)


No estoy seguro de si este problema está relacionado con la actualización a macOS Sierra, pero desde ese momento este error se produce cuando corro '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

He intentado ejecutar

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

Pero me da este error:

fatal: Not a git repository (or any of the parent directories): .git
Author: Martin van Houte, 2016-09-21

3 answers

Tuve el mismo problema después de actualizar a Sierra.

Además de brew --prefix, que muestra la ruta de instalación de Homebrew, también está brew --repository, que muestra dónde se encuentra el directorio .git.

man brew dice que afirma que "para instalaciones estándar, el prefijo y el repositorio son el mismo directorio". O la página man está desactualizada o mi instalación no es "estándar", pero mi prefix es /usr/local y mi repository es /usr/local/Homebrew.

Usando el mismo comando pero con cd $(brew --repository) trabajado para me:

cd $(brew --repository) && git fetch && git reset --hard origin/master
 59
Author: thomasd,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-09-21 15:31:10

La respuesta aceptada no funcionó para mí. Lo que funcionó fue desinstalar homebrew y reinstalarlo:

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
Author: herrtim,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-09-23 11:57:02

Nada realmente funcionó para mí, tuve que recurrir a desinstalar y reinstalar 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
Author: a20,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-04-28 05:15:14