矩池云上 git clone --recursive 出错,怎么解决

遇到问题

有时候安装包教程里 git clone 的时候会出现以下错误:

git clone --recursive https://github.91chi.fun/https://github.com/onnx/onnx-tensorrt.git

多了一个recursive参数,字面理解就是递归的意思,表示 git clone 除了要 clone 我们指定的当前项目外,还会递归的 clone 当前项目所依赖的子项目。

在矩池云操作的时候,如果只是和之前一样,只是在主项目前面加上 github 加速下载地址,我们会发现,clone 主项目是很快,但是递归 clone 子项目的时候,还是会出错。

(base) root@PoDgzM:/home# git clone --recursive https://github.91chi.fun/https://github.com/onnx/onnx-tensorrt.git
Cloning into 'onnx-tensorrt'...
remote: Enumerating objects: 1606, done.
...
Cloning into '/home/onnx-tensorrt/third_party/onnx/third_party/pybind11'...
fatal: unable to access 'https://github.com/pybind/pybind11.git/': Failed to connect to github.com port 443: Connection timed out
fatal: clone of 'https://github.com/pybind/pybind11.git' into submodule path '/home/onnx-tensorrt/third_party/onnx/third_party/pybind11' failed
Failed to clone 'third_party/pybind11'. Retry scheduled
...

解决问题

第一步: 进入已经 clone 好的主项目目录,用 vim 指令打开.gitmodules 文件,里面记录了需要 clone 的子项目,在子项目 github url 前都加上加速地址https://github.91chi.fun/即可。

(base) root@PoDgzM:/home# cd onnx-tensorrt
(base) root@PoDgzM:/home/onnx-tensorrt# vim .gitmodules 

第二步: 执行下面命令,重新 clone 子项目。

git submodule update --init --recursive


完成以上两个步骤之后,问题就解决了~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值