简体   繁体   中英

Brew install on macOS fails with "Not a valid ref: refs/remotes/origin/master"?

Please help me find a solution to this error. I am installing brew with this command:

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

The result:

==> You are using macOS 10.13.
==> We (and Apple) do not provide support for this old version.
This installation may not succeed.
After installation, you will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew\'s GitHub,
Twitter or IRC. You are responsible for resolving any issues you experience
while you are running this old version.

==> 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 biad:admin /usr/local/Homebrew
==> Downloading and installing Homebrew...
HEAD is now at 3c84e1fef Merge pull request #10381 from jonchang/fix-version-type
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>...]'
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core failed!
fatal: Needed a single revision
invalid upstream 'origin/master'
Failed during: /usr/local/bin/brew update --force --quiet 

图片

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM