如何克隆git存储库,以便它也克隆其子模块?
运行gitclone$REPO_URL只会创建空的子模块目录。
如何克隆git存储库,以便它也克隆其子模块?
运行gitclone$REPO_URL只会创建空的子模块目录。
当前回答
试试看:
git clone --recurse-submodules
假设您已经将子模块添加到父项目中,它会自动引入子模块数据。
其他回答
试试这个。
git clone -b <branch_name> --recursive <remote> <directory>
如果在分支中添加了子模块,请确保将其添加到clone命令中。
如果是一个新项目,你可以这样做:
$ 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
克隆存储库时,可以使用--recursive标志。此参数强制git克隆存储库中所有已定义的子模块。
git clone --recursive git@repo.org:your_repo.git
克隆后,有时子模块分支可能会发生更改,因此在其之后运行以下命令:
git submodule foreach "git checkout master"
我认为你可以采取三个步骤:
git clone
git submodule init
git submodule update
我在GitHub存储库中遇到了同样的问题。我的帐户缺少SSH密钥。该过程是
生成SSH密钥向GitHub帐户添加新的SSH密钥
然后,您可以使用子模块克隆存储库(gitclone--递归YOUR-git-REPO-URL)
or
运行gitsubmodule init和gitsubmodule update以获取已克隆存储库中的子模块。