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

Git克隆连接超时,执行依赖安装脚本遇问题求助

解决Git连接GitHub超时问题

错误信息

Installing https://raw.githubusercontent.com/torch/rocks/master/cwrap-scm-1.rockspec...
Using https://raw.githubusercontent.com/torch/rocks/master/cwrap-scm-1.rockspec...
switching to 'build' mode
Cloning into 'cwrap'...
fatal: unable to connect to github.com:
github.com[0: 140.82.121.3]: errno=Connection timed out

可行解决方案

  • 切换Git克隆协议
    若脚本中使用SSH协议克隆仓库,手动替换为HTTPS格式(如将git@github.com:xxx/xxx.git改为https://github.com/xxx/xxx.git);反之,若用HTTPS超时,尝试换成SSH协议。

  • 配置Git代理(针对需代理的网络环境)
    执行以下命令设置代理:

    # 设置HTTP代理
    git config --global http.proxy http://你的代理地址:端口
    # 设置HTTPS代理
    git config --global https.proxy https://你的代理地址:端口
    

    无需代理时,取消配置:

    git config --global --unset http.proxy
    git config --global --unset https.proxy
    
  • 手动绑定GitHub DNS解析

    1. 查询github.com的可用IP(通过DNS查询工具获取最新有效地址)
    2. 修改hosts文件:
      • Linux/macOS:执行sudo nano /etc/hosts
      • Windows:以管理员权限打开C:\Windows\System32\drivers\etc\hosts
    3. 添加一行(替换为你查到的IP):140.82.121.3 github.com
    4. 刷新DNS缓存:
      • Linux:sudo systemctl restart nscd(不同发行版操作可能有差异)
      • macOS:sudo dscacheutil -flushcache
      • Windows:ipconfig /flushdns
  • 手动克隆依赖后再运行脚本
    先手动克隆所需的cwrap仓库到脚本预期的路径:

    git clone https://github.com/torch/cwrap.git
    

    完成后再重新执行安装脚本。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.15 21:05:23