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

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


当前回答

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

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

or

git clone --recurse-submodules

其他回答

试试看:

git clone --recurse-submodules

假设您已经将子模块添加到父项目中,它会自动引入子模块数据。

只需在项目目录中执行这些操作。

$ git submodule init
$ git submodule update

如果子模块被添加到分支中,请确保将其包含在克隆命令中。。。

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

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

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

更新所有子模块的代码

git submodule update --recursive --remote

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

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