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

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


当前回答

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

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

其他回答

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

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

我在GitHub存储库中遇到了同样的问题。我的帐户缺少SSH密钥。该过程是

生成SSH密钥向GitHub帐户添加新的SSH密钥

然后,您可以使用子模块克隆存储库(gitclone--递归YOUR-git-REPO-URL)

or

运行gitsubmodule init和gitsubmodule update以获取已克隆存储库中的子模块。

克隆存储库时,可以使用--recursive标志。此参数强制git克隆存储库中所有已定义的子模块。

git clone --recursive git@repo.org:your_repo.git

克隆后,有时子模块分支可能会发生更改,因此在其之后运行以下命令:

git submodule foreach "git checkout master"

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

$ 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存储库中包含子模块。

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

or

git clone --recurse-submodules