Brew installation - not a valid reference error
Asked Answered
L

4

5

I am trying to install homebrew on macos m1 chip, with the one-line command but keep running into the following error. Could someone please help me to fix this? Thank you.

/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:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew

Press RETURN to continue or any other key to abort:
==> /usr/bin/sudo /usr/sbin/chown -R miththinda:admin /opt/homebrew
==> Downloading and installing Homebrew...
HEAD is now at a0ae4a7a0 Merge pull request #12658 from sjackman/sj/linkage-checker
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>...]'
Lifton answered 3/1, 2022 at 5:7 Comment(0)
L
13

Removing the directory and trying to reinstall worked for me.

sudo rm -rf /opt/homebrew
Lifton answered 3/1, 2022 at 5:27 Comment(1)
This solution was saved me. ThankzPhotima
W
3

Please run the following commands in your terminal:

rm -fr $(brew --repo homebrew/core)  # because you can't `brew untap homebrew/core`
brew tap homebrew/core

You can check the details of the issue here.

Wendellwendi answered 7/4, 2022 at 12:8 Comment(0)
C
0

Had a similar issue on Mac, I uninstalled it first by typing the command below and I installed Xcode, it worked for me after running the install command again.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Colin answered 17/1, 2022 at 18:10 Comment(0)
H
0

I first installed it onto my Linux system using the command recommended on the homebrew install page:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

but it seem to take a long time, and "hung" showing the output:

Resolving deltas: 100% (793706/793706), done.

for quite a while. I was impatient and killed the process then, and tried the install again. That is when I got the error reported by the OP. The fix was to uninstall the partially installed homebrew, and install again:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Hedge answered 23/2, 2022 at 19:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.