仓库克隆时清空 Git 子模块文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11358082/
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-10 14:04:35  来源:igfitidea点击:

Empty Git submodule folder when repo cloned

gitversion-controlgit-submodulesgit-clone

提问by jcubic

I have one repo hosted at https://github.com/aikiframework/json. On my local copy, I added a submodule using the command

我在https://github.com/aikiframework/json托管了一个存储库。在我的本地副本上,我使用以下命令添加了一个子模块

git submodule add [email protected]:jcubic/json-rpc.git json-rpc

Then I did a commit and push, and the changes appear on GitHub (I can click on it). But when I clone the repo

然后我做了一个提交和推送,更改出现在 GitHub 上(我可以点击它)。但是当我克隆回购

git clone https://github.com/aikiframework/json.git

the submodule folder json-rpc is empty.

子模块文件夹 json-rpc 是空的。

What am I missing here? Did I forget about something? Why is that folder empty?

我在这里缺少什么?我是不是忘记了什么?为什么那个文件夹是空的?

回答by jcubic

OK I found it, needed to add --recursivewhen cloning the repo.

好的,我找到了,需要--recursive在克隆 repo 时添加。

So the clone command ends up as:

所以克隆命令最终为:

git clone https://github.com/aikiframework/json.git --recursive