我正在尝试通过以下方式更新子模块:
git submodule update --recursive
.gitmodules 是:
[submodule "test"]
path = test
url = https://<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="13677660676660766153747a677f72713d7c6174" rel="noreferrer noopener nofollow">[email protected]</a>/test/test.git
另一位开发人员在 develop
分支上更新了 .gitmodules
,如下所示:
[submodule "test"]
path = test
url = <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c7a0aeb387a0aeb3aba6a5e9a8b5a0" rel="noreferrer noopener nofollow">[email protected]</a>/test/test.git
我遵循了这些代码:
git pull origin develop
git checkout develop
git submodule update --recursive
我检查了 .gitmodules
文件,它已更改,但它仍然询问我测试用户的密码。我不明白哪里做错了。
最佳答案
git submodule update
不直接使用 .gitmodules
— 它使用 .git/config
中由 git 复制的 URL子模块初始化
。当您需要更新已更改的 .gitmodules
中的 URL 时,请运行 git submodule sync
.
关于 pull 分支后 Git 子模块更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65945721/