Git 子模块返回空白?

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

Git submodule is returning blank?

git

提问by Joe Simpson

I'm trying to use git submodule updateand it's not returning anything, nor does any of the git submodulecommands, and I have checked the .gitmodulesfile and it is correct?

我正在尝试使用git submodule update它并没有返回任何内容,也没有返回任何git submodule命令,并且我已经检查了.gitmodules文件并且它是正确的?

I have no idea if git can be debugged or what, and it's really annoying.

我不知道git是否可以调试或什么,这真的很烦人。

There's no errors or anything, even when using 2>&1on the end which is really worrying.

没有错误或任何东西,即使在最后使用2>&1时也确实令人担忧。

采纳答案by Adam Dymitruk

Remove any submodule entries from your .git/config. git rm --cached path/to/submoduleto remove it from the tree. Make sure your working directory is clean. Now you can init the submodules:

从您的.git/config. git rm --cached path/to/submodule将其从树上移除。确保您的工作目录是干净的。现在您可以初始化子模块:

git submodule init 

All this does is populate your config with the urls that are in the .gitmodulesfile. Now you can populate the submodules:

所有这些都是使用.gitmodules文件中的 url 填充您的配置。现在您可以填充子模块:

git submodule update

if your submodules have nested submodules, add the recursive option:

如果您的子模块有嵌套的子模块,请添加递归选项:

git submodule update --recursive

Init and update are separate for a good reason. You may want to have an alternate repository to store changes to you submodule.

Init 和 update 是分开的,这是有充分理由的。您可能希望有一个备用存储库来存储对子模块的更改。

回答by qwebek

It could be a late answer but in case someone needs it:

这可能是一个迟到的答案,但万一有人需要它:

Just delete you blank submodule directory and run again

只需删除您的空白子模块目录并再次运行

git submodule add <https/ssh git link to your submodule>

git submodule add <https/ssh git link to your submodule>