用所有子模块克隆git回购 [英] Cloning a git repo with all submodules
问题描述
我有一个包含多个子模块的工作git存储库(通过克隆不同的存储库获得)。
现在,我想要将整个存储库(包含所有子模块)复制到另一台机器上的裸机仓库,方法是使用推送或克隆。我很好地放弃了子模块的历史(我只是对保持其内容感兴趣)。
这可能吗?在我的尝试中,在克隆的存储库中,子模块目录是空的。
我知道这不是正确的工作流程(请参阅使用子模块创建公共回购),但是没有更新原始子模块的可能性。
您可以使用递归
如下:
git clone --recursive your-repo-url
另一方面,如果您已经克隆,您可以使用:
git子模块init
git子模块更新
您不会在您的子模块中丢失任何历史记录
I have a working git repository containing several submodules (obtained by cloning different repositories).
Now, I want to copy the whole repository (with all the submodules) to a bare git repo on a different machine by either using pushing or cloning. I'm fine loosing the history of the submodules (I'm just interested in keeping their content).
Is this possible ? In my attempts, in the cloned repository the submodule directory is empty.
P.S. I know that this is not the correct workflow (see creating a public repo with submodules), however there is no possibility of updating the original submodule.
You can clone the git repo with all submodule using recursive
as follow:
git clone --recursive your-repo-url
on the other hand if you have already cloned, you can use:
git submodule init
git submodule update
You won't lose any history in your submodule
这篇关于用所有子模块克隆git回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!