最近在mac系统上需要使用brew安装一个软件,但是安装的时候就提示要git更新brew。原因就是homebrew-core is a shallow clone,这个错误表明你需要将 homebrew-core 从浅克隆(shallow clone)切换为完整克隆(full clone)。浅克隆的更新受到限制,因此无法正常 brew update。
所以需要执行以下命令完全克隆,但是执行命令之后:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
下载到一半就提示下载失败:
尝试了从github下载brew安装包,然后解压复制到目录,结果执行命令的时候又给我初始化git,然后下载失败。
最后解决方法,还是得使用git,只不过要切换下载源。
rm -rf /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
安装brew成功:
brew安装软件成功: