pull 分支后 Git 子模块更新

标签 git git-submodules

我正在尝试通过以下方式更新子模块:

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/

相关文章:

git - 为什么我必须 --force 我的 git 提交

git - 在 git merge 命令中使用 --no-ff 的最佳实践是什么?

linux - git repo 中的文件都已删除且未被跟踪,但它们仍然存在。这怎么可能?

Github - 如何使用 Web 界面创建子模块

git - 使用具有只读访问权限的 git 子模块

git - 防止 git stash 使用非托管文件?

混帐针导入 : how to make one master branch?

git - "git submodule absorbgitdirs"的对面/反面?

git - 通过 --tags 获取 git refs 时, "upload-pack: not our ref"是什么意思?

git - 从 svn 迁移到 git 保持 svn-externals