【问题标题】:.git/config and .gitmodules not in sync.git/config 和 .gitmodules 不同步
【发布时间】:2016-12-08 11:48:04
【问题描述】:

我想从引用的子模块中提取代码。我试过git submodule update --init,它什么也没做。

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

.git/config:

[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,相关存储库被拉起?

【问题讨论】:

    标签: git git-submodules


    【解决方案1】:

    你必须跑

    git submodule update

    运行后git submodule init

    git submodule update 是真正将所有子模块拉入并签出所引用 sha 的工作副本的那个

    【讨论】:

    猜你喜欢
    • 2012-05-14
    • 2020-02-04
    • 2019-10-22
    • 2013-12-05
    • 2012-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多