添加跟踪 master 的 git 子模块



我正在使用 git 1.8.4 并尝试添加一个跟踪另一个存储库主的子模块。我尝试按如下方式添加它:

git submodule add -b master /path/to/myrepo.git

当我尝试添加它时,我收到以下错误

Cloning into 'myrepo.git'...
warning: You appear to have cloned an empty repository.
done.
fatal: Cannot update paths and switch to branch 'master' at the same time.
Did you intend to checkout 'origin/master' which can not be resolved as commit?
Unable to checkout submodule 'myrepo'

我不确定这意味着什么...有人可以解释一下吗?

子模块似乎没有分支(即:"cd submodule ; git branch -avvv"不返回任何内容)这一事实意味着父存储库中的子模块配置未正确初始化和更新。

我评论说:

一种继续前进的方法是从父存储库的新克隆开始(不引用您的子模块),然后重复这些步骤:

git submodule add -b master /path/to/myrepo.git ; 
git submodule update --remote --init. –

最新更新