.git / config和.gitmodules不同步

时间:2016-12-08 11:48:05

标签: git git-submodules

我想从引用的子模块中提取代码。我尝试了git submodule update --init,它没有做任何事情。

读到,我意识到这可能是因为我的.git / config文件没有设置。 我的.git / config不包含有关子模块的任何内容。

的.git /配置:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = ssh://ShubhamRathi@gerrit.opnfv.org:29418/opnfvdocs
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[remote "gerrit"]
    url = ssh://ShubhamRathi@gerrit.opnfv.org:29418/opnfvdocs.git
    fetch = +refs/heads/*:refs/remotes/gerrit/*
[user]
    email = shubhamiiitbackup@gmail.com
[branch "Testingdoc"]
    remote = origin
    merge = refs/heads/master

但是我的.gitmodule包含对子模块的引用

[submodule "docs/testing/docs/submodules/apex"]
    path = docs/testing/docs/submodules/apex
    url = https://gerrit.opnfv.org/gerrit/apex
[submodule "docs/testing/docs/submodules/armband"]
    path = docs/testing/docs/submodules/armband
    url = https://gerrit.opnfv.org/gerrit/armband

我的问题是,如何将这两个文件同步到git submodule update --init,相关的存储库被拉出?

1 个答案:

答案 0 :(得分:0)

你必须运行

git submodule update

运行git submodule init

git submodule update是真正提取所有子模块并检出所引用sha的工作副本的那个