Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Homebrew shows git-related errors

Recently, when I run brew install with any package, before starting installation Homebrew is always showing the following git-related output.

error: Cannot determine remote HEAD
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>...]'
error: Cannot determine remote HEAD
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>...]'

Remark: just to clarify, yes, it is the same message printed twice.
(but perhaps each message is related to a different repository)

I tried to make some auto fixes running brew doctor and brew cleanup but the above output is still showing up.

What does it mean? Perhaps something got altered after installing some packages?

Do you have any suggestion on how to fix this?

like image 914
Kubuntuer82 Avatar asked Dec 10 '25 23:12

Kubuntuer82


1 Answers

I had similar error on my MacBook Pro M1 due to network problems, this worked for me:

rm -rf /opt/homebrew

Or it might be in another path

rm -rf /etc/homebrew

Check both directories for the homebrew directory and delete it.

like image 96
Mike Petrov Avatar answered Dec 12 '25 12:12

Mike Petrov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!