我正在使用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'
我不确定这是什么意思……有人可以解释一下吗?
git checkout -b master origin/master
命令,返回上一级目录,然后执行git submodule update --remote --init
命令? - VonCgit branch -b master; git reset --hard origin/master
(如https://dev59.com/gGQn5IYBdhLWcg3wCzik#17137740所示)。但是,如果它仍然抱怨“origin / master”,那么该子模块的远程可能不正确。git remote -v
返回什么?实际repo/path/to/myrepo.git
中是否有主分支? - VonCgit submodule add -b master /path/to/myrepo.git ; git submodule update --remote --init
。 - VonC