Mac安装homebrew报错 error: Not a valid ref: refs/remotes/origin/master

场景

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 [...] -- [...]'

安装完之后,下载 nginx 时报错,主要的报错信息如上所示。

解决方案

  1. 删除原有的brew

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

    git config --global core.compression 0
    
  3. 设置Git buffer size :

    git config --global http.postBuffer 1048576000
    
  4. 重新安装 brew

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

参考文献

blog.csdn.net/SmalOSnail/…