如何克隆git存储库,以便它也克隆其子模块?

运行gitclone$REPO_URL只会创建空的子模块目录。


当前回答

尝试在git存储库中包含子模块。

git clone -b <branch_name> --recursive <remote> <directory>

or

git clone --recurse-submodules

其他回答

在填充子模块之前,您必须做两件事:

git submodule init 
git submodule update

如果是一个新项目,你可以这样做:

$ git clone --recurse-submodules https://github.com/chaconinc/YourProjectName 

如果已安装,则:

$ cd YourProjectName (for the cases you are not at right directory) 
$ git submodule init
$ git submodule update

[快速回答]

克隆父回购(包括一些子模块回购)后,请执行以下操作:

git submodule update --init --recursive

使用此命令克隆所有子模块的repo

git clone --recurse-submodules git@gitlab.staging-host.com:yourproject

更新所有子模块的代码

git submodule update --recursive --remote

1.git子模块初始化2位子模块更新

或者可能git存储-ugit拉动原点主机数字存储p