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
Git submodule is returning blank?
提问by Joe Simpson
I'm trying to use git submodule update
and it's not returning anything, nor does any of the git submodule
commands, and I have checked the .gitmodules
file 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>&1
on the end which is really worrying.
没有错误或任何东西,即使在最后使用2>&1
时也确实令人担忧。
采纳答案by Adam Dymitruk
Remove any submodule entries from your .git/config
. git rm --cached path/to/submodule
to 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 .gitmodules
file. 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
>