如何克隆git存储库,以便它也克隆其子模块?
运行gitclone$REPO_URL只会创建空的子模块目录。
如何克隆git存储库,以便它也克隆其子模块?
运行gitclone$REPO_URL只会创建空的子模块目录。
当前回答
如果是一个新项目,你可以这样做:
$ 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 init
$ git submodule update
[快速回答]
您可以使用此命令克隆包含所有子模块的repo:
git clone --recursive YOUR-GIT-REPO-URL
或者,如果您已经克隆了项目,则可以使用:
git submodule init
git submodule update
在填充子模块之前,您必须做两件事:
git submodule init
git submodule update
如果子模块被添加到分支中,请确保将其包含在克隆命令中。。。
git clone -b <branch_name> --recursive <remote> <directory>
迟交的答复
// git CLONE INCLUDE-SUBMODULES ADDRESS DESTINATION-DIRECTORY
git clone --recursive https://USERNAME@bitbucket.org/USERNAME/REPO.git DESTINATION_DIR
正如我刚刚花了整整一个小时和一个朋友在一起闲逛:即使你有BitBucket的管理员权限,也要克隆原始存储库,并使用拥有回购的人的密码。发现你撞上了这个地雷陷阱,我很恼火:P