添加包含另一个子模块的 git 子模块?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4600835/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 04:54:07  来源:igfitidea点击:

Adding git submodule that contains another submodule?

gitgithubgit-submodules

提问by Matt Huggins

I'm working on a project in one git repository (A) that is including another git repository (B), which in turn includes a third git repository (C). In A, I added B via:

我正在一个 git 存储库 (A) 中处理一个项目,该项目包括另一个 git 存储库 (B),后者又包含第三个 git 存储库 (C)。在 A 中,我通过以下方式添加了 B:

git submodule add https://github.com/blt04/sfDoctrine2Plugin.git plugins/sfDoctrine2Plugin

Click here, and you can see where B references C: https://github.com/doctrine/doctrine2

点击这里,你可以看到B引用C的地方:https: //github.com/doctrine/doctrine2

After doing my git submodule add, my plugins/sfDoctrine2Plugin/lib/vendor/doctrinefolder (should contain C) is empty. I tried doing a git submodule update --recursiveas per this StackOverflow answer, but it still didn't import the files to that path. I'm at a loss as to what to do here.

在我的 git submodule add 之后,我的plugins/sfDoctrine2Plugin/lib/vendor/doctrine文件夹(应该包含 C)是空的。我尝试git submodule update --recursive按照这个 StackOverflow answer做一个,但它仍然没有将文件导入到该路径。我不知道在这里做什么。

回答by Lily Ballard

You need to do git submodule update --init --recursive. The problem here is the submodule C is never being initialized in the first place.

你需要做git submodule update --init --recursive。这里的问题是子模块 C 从来没有被初始化。