You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

安装Homebrew至60%时出现git fetch失败报错,求解决方法

解决Homebrew安装时Git TLS报错的方案

方法1:增大Git的HTTP缓存阈值

这类报错常因Git默认缓存容量不足导致传输中断,执行以下命令调整缓存设置:

git config --global http.postBuffer 524288000
git config --global http.maxRequestBuffer 100M

设置完成后重新运行Homebrew安装命令。

方法2:切换Git的TLS后端为OpenSSL

系统默认的GnuTLS可能存在解码兼容性问题,切换到OpenSSL可解决:

git config --global http.sslBackend openssl

之后重新执行Homebrew安装流程。

方法3:清理残留后重新安装

若之前的安装残留干扰了正常流程,先彻底卸载再重新安装:

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

卸载完成后,运行官方安装命令:

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

方法4:使用国内镜像源加速(针对网络访问受限场景)

国内网络访问GitHub不稳定时,用国内镜像源替代官方源:

/bin/bash -c "$(curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git)"

安装完成后配置后续使用的镜像源,避免再次出现网络问题:

git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
brew update

内容的提问来源于stack exchange,提问作者Devansh Gupta

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.05 08:15:52