矩池云上 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
完成以上两个步骤之后,问题就解决了~
上一篇:
通过多线程提高代码的执行效率例子