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

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


当前回答

[快速回答]

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

git submodule update --init --recursive

其他回答

试试看:

git clone --recurse-submodules

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

试试这个。

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

如果在分支中添加了子模块,请确保将其添加到clone命令中。

尝试在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