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
brew update leads to missing ref
The least you can do - Meta Jon
"error: Not a valid ref: refs/remotes/origin/master" when installing brew
Brew update fails
I need to install brew, as I need pod, to execute "pod install"
However, I am getting stuck for long time, during brew installation.
I have tried
-
Good Internet connection
-
Try VPN
-
Use Google DNS
-
Restart few times
-
No anti-virus
But... it still doesn't work for me :-( I am getting similar error, and I have no more idea how to proceed
I also check the git. Seem legit
yccheok@Yans-MacBook-Pro ~ % git --version git version 2.24.3 (Apple Git-128)
Have setup email for git
yccheok@Yans-MacBook-Pro ~ % git config --global user.email xxx@gmail.com
Have read
-
#666
-
https://stackoverflow.com/questions/39836190/homebrew-install-failed-during-git-fetch-origin-masterrefs-remotes-origin-mas
-
Homebrew/brew#10878
But still getting the below error no matter how many times I have tried
yccheok@Yans-MacBook-Pro ~ % git config --global user.email xxx@gmail.com yccheok@Yans-MacBook-Pro ~ % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ==> Checking for `sudo` access (which may request your password). Password: ==> This script will install: /usr/local/bin/brew /usr/local/share/doc/homebrew /usr/local/share/man/man1/brew.1 /usr/local/share/zsh/site-functions/_brew /usr/local/etc/bash_completion.d/brew /usr/local/Homebrew Press RETURN to continue or any other key to abort ==> /usr/bin/sudo /usr/sbin/chown -R yccheok:admin /usr/local/Homebrew ==> Downloading and installing Homebrew... remote: Enumerating objects: 19, done. remote: Counting objects: 100% (19/19), done. remote: Compressing objects: 100% (7/7), done. remote: Total 28 (delta 12), reused 12 (delta 12), pack-reused 9 Unpacking objects: 100% (28/28), done. From https://github.com/Homebrew/brew 1777a03aac..731e25e0cc master -> origin/master HEAD is now at 731e25e0cc Merge pull request #11041 from xxyzz/man error: Not a valid ref: refs/remotes/origin/master fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' fatal: SHA1 COLLISION FOUND WITH e9405b4a427b316ef3e5f01422bcf58e74982ad0 ! fatal: index-pack failed Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core failed! fatal: invalid upstream 'origin/master' Failed during: /usr/local/bin/brew update --force --quiet
Any idea what could went wrong? Thanks
It seems you are trying to overwrite an existing install that has a broken core tap. Try deleting the homebrew core folder like this:
rm -fr $(brew --repo homebrew/core)
Then reinstall homebrew using:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Hope this works for you.
This generally happens when something with homebrew/core is corrupt.
% find /opt/homebrew /usr/local/ -type d -name homebrew-core -print
% rm -rf the-directories-found-in-the-above-find
% brew tap homebrew/core
First find your homebrew-core, then remove (rm -rf), then reinstall. If this fails because it didn't install enough to get a working brew, then remove the directory and retry the initial install.
After a few hours of research and brute force I learned the issue was due to git not being configured properly. Some articles suggested downgrading your git or reinstalling all together. However, I resolved the issue just by adding the following
git config --global user.email yourgitemail@example.com
Then remove the cellar and homebrew directories from /usr/local and re-try the installation.
- create a file named
run.sh - add this:
rm -rf /usr/local/bin/brew
rm -rf /usr/local/share/doc/homebrew
rm -rf /usr/local/share/man/man1/brew.1
rm -rf /usr/local/share/zsh/site-functions/_brew
rm -rf /usr/local/etc/bash_completion.d/brew
rm -rf /usr/local/Homebrew
- run the file using
sh run.sh
Or, just run all these commands manually one by one.
[SOLVED]
Well, it's my first time dealing with this "Git interface". After using commands like:
"git init"
"git remote add origin [link of my repository on Github with that ".git" after its link]"
I tried to make that "pull" command:
"git pull origin master"
however, it's probably not working due to this warning thrown by the terminal:
"fatal: couldn't find remote ref master"
Why is this error happening? How should I fix it?