(一)如何添加子依赖项目
从github上下载下来的文件,例如,
https://github.com/CloudCompare/CloudCompare/archive/refs/tags/v2.12.0.tar.gz
里面明明是有一个在.gitmodules文件的,内容如下,
[submodule "plugins/core/IO/qE57IO/extern/libE57Format"]
path = plugins/core/IO/qE57IO/extern/libE57Format
url = https://github.com/asmaloney/libE57Format
[submodule "extern/CCCoreLib"]
path = libs/qCC_db/extern/CCCoreLib
url = https://github.com/CloudCompare/CCCoreLib
[submodule "plugins/core/Standard/qPoissonRecon/extern/PoissonRecon"]
path = plugins/core/Standard/qPoissonRecon/extern/PoissonRecon
url = https://github.com/cloudcompare/PoissonRecon
[submodule "plugins/core/Standard/qMPlane"]
path = plugins/core/Standard/qMPlane
url = https://github.com/hvs-ait/mplane-plugin
[submodule "plugins/core/Standard/qColorimetricSegmenter"]
path = plugins/core/Standard/qColorimetricSegmenter
url = https://gitlab.univ-nantes.fr/E164955Z/ptrans
[submodule "plugins/core/Standard/qMasonry"]
path = plugins/core/Standard/qMasonry
url = https://github.com/CyberbuildLab/masonry-cc
[submodule "plugins/core/Standard/qJSonRPCPlugin"]
path = plugins/core/Standard/qJSonRPCPlugin
url = https://gitlab.com/theadib/JSonRPCPlugin.git
[submodule "plugins/core/Standard/qCanupo/contrib/dlib"]
path = plugins/core/Standard/qCanupo/contrib/dlib
url = https://github.com/davisking/dlib.git
可是,当你希望通过下面的指令克隆这些子项目依赖项时,会发现根本就没有反应【1】。
办法(1)当然你可以手动一个个去添加,不过这会非常麻烦。
办法(2)使用分支,
> git clone -b v2.12.0 --recursive https://github.com/CloudCompare/CloudCompare.git CC2120b
这里命名CC2120b是拷贝下来后重新命名的文件夹名称。
但这有个问题,有些项目是没有子分支的,或者,某些项目已经被删除了,git命令没办法找到github上的origin项目。
办法(3)使用脚本(具体可参考资料【1】)
假设你的项目解压后在CC2120b文件夹内,那就在这个文件夹内建一个脚本script.sh,然后在git bash中运行这些脚本就好了(使用命令:sh script.sh),
如果需要逐个克隆并回复y:
#!/bin/bash
set -e
rm -rf .git
git init
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' > tempfile
while read -u 3 path_key path
do
url_key=$(echo $path_key | sed 's/\.path/.url/')
url=$(git config -f .gitmodules --get "$url_key")
read -p "Are you sure you want to delete $path and re-initialize as a new submodule? " yn
case $yn in
[Yy]* ) rm -rf $path; git submodule add $url $path; echo "$path has been initialized";;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done 3
关注
打赏
热门博文
- 对CSDN网站关于抄袭的投诉的处理建议
- Tesseract OCR训练时碰到的问题和解决方案
- VSCODE在Jetson Nano上打不上断点,无法调试python源码
- ROS2进阶:在windows10上用vs2019编译rviz2
- ROS2 ERROR: OpenGL 1.5 is not supported in GLRenderSystem::initialiseContext at C:\ci\ws\build...
- ROS2 error: can‘t find examples_rclcpp_minimal_subscriber/Release/wait_set_subscriber_library.lib
- 在windows上安装 chocolatey.1.1.0.nupkg
- Qt开发高级进阶:如何在显示时适合视窗宽度和高度(fitWidth+fitHeight)
- PySpark ERROR: Python in worker has different version 3.9 than that in driver 3.8
- cv2.imshow error: The function is not implemented. Rebuild the library with Windows...