升级macOS Ventura后执行pod install遇GitHub连接超时求助
解决Mac Ventura升级后
pod install因GitHub连接超时失败的问题 问题定位
报错核心是git clone GitHub仓库时连接超时(errno=Operation timed out),属于网络或Git配置层面的问题,和Ventura升级后的网络环境、配置重置有关。
解决方案
测试网络连通性并调整DNS
- 执行
ping github.com,如果返回超时,先修改系统DNS:- 打开「系统设置」→「网络」→ 选中当前网络→「详情」→「DNS」
- 添加公共DNS:
8.8.8.8(Google)或1.1.1.1(Cloudflare),移除旧DNS
- 重新执行
ping github.com,确认能正常连通后再尝试pod install
- 执行
清理Git代理配置
Ventura升级可能导致旧代理配置失效,执行以下命令重置:git config --global --unset http.proxy git config --global --unset https.proxy如果需要使用代理,重新设置正确的代理地址(替换为你的代理端口):
git config --global https.proxy http://127.0.0.1:xxxx重置CocoaPods缓存
清理旧缓存后重新安装:pod cache clean --all rm -rf Podfile.lock Pods pod install改用SSH协议克隆仓库
如果HTTPS协议始终无法连通,切换到SSH:- 生成SSH密钥(如果没有):
ssh-keygen -t ed25519 -C "your_email@example.com" - 将
~/.ssh/id_ed25519.pub中的内容添加到GitHub账户的「SSH and GPG keys」列表中 - 配置Git自动替换HTTPS为SSH:
git config --global url."git@github.com:".insteadOf "https://github.com/" - 重新执行
pod install
- 生成SSH密钥(如果没有):
检查系统防火墙
确认Ventura防火墙未阻止Git联网:- 打开「系统设置」→「隐私与安全性」→「防火墙」→「防火墙选项」
- 检查
git(路径通常为/usr/local/bin/git)是否被允许联网,若未添加则手动允许
内容的提问来源于stack exchange,提问作者MacPhi
相关产品推荐
相关产品推荐

