git子模块更新--远程不工作

git子模块更新--远程不工作,git,git-submodules,Git,Git Submodules,我克隆了一个git存储库,mainrepo,它有一个子模块submodule1。当我尝试从子模块1获取最新更新时: $ cd mainrepo $ git submodule add git@bitbucket.org:myaccount/submodule1.git $ git submodule update --remote submodule1 Usage: git submodule [--quiet] add [-b branch] [--reference <reposi

我克隆了一个git存储库,
mainrepo
,它有一个子模块
submodule1
。当我尝试从
子模块1
获取最新更新时:

$ cd mainrepo

$ git submodule add git@bitbucket.org:myaccount/submodule1.git

$ git submodule update --remote submodule1
Usage: git submodule [--quiet] add [-b branch] [--reference <repository>] [--] <repository> [<path>]
   or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
   or: git submodule [--quiet] init [--] [<path>...]
   or: git submodule [--quiet] update [--init] [-N|--no-fetch] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
   or: git submodule [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
   or: git submodule [--quiet] foreach [--recursive] <command>
   or: git submodule [--quiet] sync [--] [<path>...]

$ git submodule update --remote
Usage: git submodule [--quiet] add [-b branch] [--reference <repository>] [--] <repository> [<path>]
   or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
   or: git submodule [--quiet] init [--] [<path>...]
   or: git submodule [--quiet] update [--init] [-N|--no-fetch] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
   or: git submodule [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
   or: git submodule [--quiet] foreach [--recursive] <command>
   or: git submodule [--quiet] sync [--] [<path>...]
为什么
子模块更新--remote submodule1
命令不起作用

也许这会有帮助:

$ vim mainrepo/.git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git@bitbucket.org:myaccount/mainrepo.git
[branch "master"]
        remote = origin
        merge = refs/heads/master
[submodule "local/src/utils"]
        url = git@bitbucket.org:myaccount/submodule1.git

$ vim .gitmodules
[submodule "submodule1"]
        path = submodule1
        url = git@bitbucket.org:myaccount/submodule1.git

我建议您阅读git子模块速成课程:

我的猜测是,由于您克隆的存储库已经有一个子模块(检查repo根目录中的
.gitmodules
),因此您不必再次添加它

克隆存储库,然后运行
git子模块更新--recursive
就足够了


或者,
git clone--recurse submodules
会自动为您执行此操作。

我建议您阅读git子模块的本速成课程:

我的猜测是,由于您克隆的存储库已经有一个子模块(检查repo根目录中的
.gitmodules
),因此您不必再次添加它

克隆存储库,然后运行
git子模块更新--recursive
就足够了


或者,
git clone--recurse submodules
会自动为您执行此操作。

git的哪个版本(
git--version
)?该计算机上的垃圾git版本是1.7.1。。。更新远程子模块在我的个人计算机上工作,哪个git版本更新为2.9.0。git的哪个版本(
git--version
)?该计算机上的垃圾git版本是1.7.1。。。更新远程子模块在我的个人计算机上工作,git版本更新为2.9.0。
git clone——递归子模块
修复了它。通常,“子模块更新递归”应该可以工作,但由于某些原因不能工作。关于后者的任何线索?
git clone——递归子模块
修复了它。通常,“子模块更新递归”应该可以工作,但由于某些原因不能工作。有关于后来的线索吗?
$ vim mainrepo/.git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git@bitbucket.org:myaccount/mainrepo.git
[branch "master"]
        remote = origin
        merge = refs/heads/master
[submodule "local/src/utils"]
        url = git@bitbucket.org:myaccount/submodule1.git

$ vim .gitmodules
[submodule "submodule1"]
        path = submodule1
        url = git@bitbucket.org:myaccount/submodule1.git