Tag Archives: error: Not a valid ref: refs/remotes/origin/master

[Solved] Mac Install homebrew Error: error: Not a valid ref: refs/remotes/origin/master

The MAC reports the following error after installing homeberw:

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /usr/sbin/chown -R aa:admin /opt/homebrew
==> Downloading and installing Homebrew...
HEAD is now at 8de10a05b Merge pull request #10472 from MikeMcQuaid/new-issue-templates
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 [...] -- [...]'
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error: Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-core failed!
fatal: invalid upstream 'origin/master'
Failed during: /opt/homebrew/bin/brew update --force --quiet

The solution is as follows:

Uninstall homebrew

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

Set git compression:

git config --global core.compression 0

Set git buffer size:

git config --global http.postBuffer 1048576000

Reinstall brew

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