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

在WSL中安装Oh My Zsh时遇curl超时错误求助

解决WSL Ubuntu 22 LTS中Oh My Zsh安装的curl超时问题

出现curl: (28) Failed to connect to raw.githubusercontent.com port 443 after 130799 ms: Connection timed out错误,本质是无法连接raw.githubusercontent.com,以下是几种可行的解决方法:

方法一:手动绑定raw.githubusercontent.com的IP到hosts

  • 查询可用IP:在WSL终端执行nslookup raw.githubusercontent.com,记录返回的其中一个IP地址(也可在Windows命令行执行该命令获取)
  • 编辑hosts文件:执行sudo nano /etc/hosts
  • 在文件末尾添加一行:[获取到的IP] raw.githubusercontent.com(例如185.199.108.133 raw.githubusercontent.com)
  • 保存退出:按Ctrl+O确认保存,回车后按Ctrl+X退出编辑器
  • 重新运行Oh My Zsh的安装命令

方法二:使用国内镜像源安装

直接执行国内镜像的安装命令,跳过raw.githubusercontent.com:

sh -c "$(curl -fsSL https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh)"

方法三:配置WSL网络代理(若Windows使用代理)

  • 查看Windows主机IP:在WSL终端执行cat /etc/resolv.conf,找到nameserver后的地址,这就是Windows的内网IP
  • 设置代理环境变量:执行以下命令(替换[WindowsIP]和[端口]为你的代理实际信息):
    export http_proxy=http://[WindowsIP]:[端口]
    export https_proxy=http://[WindowsIP]:[端口]
    
  • 重新运行Oh My Zsh的安装命令

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.18 14:22:12