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

无法克隆socket.io子模块,多次尝试仍失败求助

解决Git子模块socket.io克隆失败问题

问题详情

执行git clone --recursive -j8 https://github.com/saikat/DrawTogether.git克隆DrawTogether仓库时,主仓库克隆成功,但socket.io子模块无法克隆,错误输出如下:

C:\Users\raj\Desktop>git clone --recursive -j8 https://github.com/saikat/DrawTogether.git
Cloning into 'DrawTogether'...
remote: Enumerating objects: 505, done.
remote: Total 505 (delta 0), reused 0 (delta 0), pack-reused 505
Receiving objects: 100% (505/505), 1.04 MiB | 2.10 MiB/s, done.
Resolving deltas: 100% (75/75), done.
Submodule 'lib/socket.io' (git://github.com/LearnBoost/Socket.IO-node.git) registered for path 'lib/socket.io'
Cloning into 'C:/Users/raj/Desktop/DrawTogether/lib/socket.io'...
fatal: unable to connect to github.com:
github.com[0: 20.205.243.166]: errno=Unknown error

fatal: clone of 'git://github.com/LearnBoost/Socket.IO-node.git' into submodule path 'C:/Users/raj/Desktop/DrawTogether/lib/socket.io' failed
Failed to clone 'lib/socket.io'. Retry scheduled
Cloning into 'C:/Users/raj/Desktop/DrawTogether/lib/socket.io'...
fatal: unable to connect to github.com:
github.com[0: 20.205.243.166]: errno=Unknown error

fatal: clone of 'git://github.com/LearnBoost/Socket.IO-node.git' into submodule path 'C:/Users/raj/Desktop/DrawTogether/lib/socket.io' failed
Failed to clone 'lib/socket.io' a second time, aborting

尝试执行以下命令重试:

git submodule init
git submodule update

但仍出现相同错误:

Cloning into 'C:/Users/raj/Desktop/DrawTogether/lib/socket.io'...    fatal: unable to connect to github.com: github.com[0:
   20.205.243.166]: errno=Unknown error
       fatal: clone of 'git://github.com/LearnBoost/Socket.IO-node.git' into    submodule path 'C:/Users/raj/Desktop/DrawTogether/lib/socket.io'    failed Failed to clone 'lib/socket.io'. Retry scheduled Cloning into    'C:/Users/raj/Desktop/DrawTogether/lib/socket.io'... fatal: unable to    connect to github.com: github.com[0: 20.205.243.166]: errno=Unknown    error
       fatal: clone of 'git://github.com/LearnBoost/Socket.IO-node.git' into    submodule path 'C:/Users/raj/Desktop/DrawTogether/lib/socket.io'    failed Failed to clone 'lib/socket.io' a second time, aborting

解决方法

1. 单独修改子模块协议为HTTPS

进入已克隆的主仓库目录,修改子模块的远程URL为HTTPS后重新更新:

cd DrawTogether
git config submodule.lib/socket.io.url https://github.com/LearnBoost/Socket.IO-node.git
git submodule update --init

2. 全局配置Git自动转换协议

若经常遇到git://协议被限制的问题,可全局设置Git将所有GitHub的git://请求转换为HTTPS:

git config --global url."https://github.com/".insteadOf git://github.com/

配置完成后,直接执行git submodule update --init即可自动使用HTTPS克隆子模块。

3. 手动克隆子模块到指定路径

如果上述方法无效,可手动克隆子模块到对应目录:

# 进入主仓库目录
cd DrawTogether
# 删除已创建的空目录(如果存在)
rmdir /s lib/socket.io
# 用HTTPS克隆子模块到指定路径
git clone https://github.com/LearnBoost/Socket.IO-node.git lib/socket.io
# 同步子模块状态
git submodule sync

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.16 03:55:37