brew: `brew update` fails to checkout tag
If Homebrew was updated on Aug 10-11th 2016 and brew update always says Already up-to-date. you need to run: cd "$(brew --repo)" && git fetch && git reset --hard origin/master && brew update.
Please follow the general troubleshooting steps first:
- Ran
brew updateand retried your prior step? - Ran
brew doctor, fixed as many issues as possible and retried your prior step? - If you’re seeing permission errors tried running
sudo chown -R $(whoami) $(brew --prefix)? I thought this -^ step is not needed anymore and root can own folder structure again? Is this still the case ?
Bug reports:
kind of regression bug for me 😦
Since a certain brew version, don’t remember which one (AFAIR the version claiming root can own /usr/local/ again) i had troubles
$ brew update
fatal: Cannot update paths and switch to branch 'stable' at the same time.
Did you intend to checkout 'refs/tags/1.0.8' which can not be resolved as commit?
fatal: Needed a single revision
invalid upstream refs/tags/1.0.8
Already up-to-date.
before it was same message with version 1.0.9 … I had a tag 1.0.9 in refs/tags/.I issued a git reset --hard to overwrite local version and it was ok . But now this bug comes back somehow ?
I do not make local changes to homebrew or whatever. I don’t understand what’s happening.
I also enable debugging see attached file
thanks for your help
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 76 (45 by maintainers)
Commits related to this issue
- Unset GREP_OPTIONS. Users may have this set, breaking grep's output. Fixes #1430. — committed to MikeMcQuaid/brew by MikeMcQuaid 7 years ago
Try to run
cd "$(brew --repo)" && git fetch && git reset --hard origin/master && brew updateI figured out the problem on my end, it turns out that one or more uses of grep were using my
$GREP_OPTIONSenvvar and breaking b/c I have color forced on. I’d changed that on my main box but hadn’t synced my dotfiles to my other laptop in a while.It might be worth doing an
unset GREP_OPTIONSat the start of the script.It will happen every time there is a new tag until we figure out what is wrong.
Same issue appeared for me a few days ago.
brew updatefatal: Cannot update paths and switch to branch ‘stable’ at the same time. Did you intend to checkout ‘refs/tags/1.1.6’ which can not be resolved as commit? fatal: Needed a single revision invalid upstream refs/tags/1.1.6 Already up-to-date.Resolved with:
cd "$(brew --repo)" && git fetch && git reset --hard origin/master && brew updateThanks for all your work @MikeMcQuaid!