This worked for me:
brew tap --repair
brew cleanup
brew update-reset
After that I was able to brew update without any issues.
Possible culprit:
dart-lang/dart: changed default branch name from master to main!
This worked for me:
brew tap --repair
brew cleanup
brew update-reset
After that I was able to brew update without any issues.
Possible culprit:
dart-lang/dart: changed default branch name from master to main!
I had the same issue.
dart-lang seemed to be the culprit.
brew update-reset said that everything was up-to-date apart from:
==> Fetching /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart...
fatal: couldn't find remote ref refs/heads/master
error: Not a valid ref: refs/remotes/origin/main
brew tap --repair failed like so:
fatal: couldn't find remote ref refs/heads/master
Error: Failure while executing; `git -C /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart fetch origin` exited with 128.
Running brew doctor didn't show up anything pertinent, so some further digging was required.
Heading over to the dart-lang repo showed the very error as an issue & in the thread there, a solution:
https://github.com/dart-lang/homebrew-dart/issues/131#issuecomment-1411094620
So here's the code that Nakji wrote there:
cd /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart
git branch -m master main
git remote remove origin
git remote add origin https://github.com/dart-lang/homebrew-dart
Follow that up with the specific brew tap --repair dart-lang/dart which can then do its magic.
Brew is now able to update