【发布时间】:2013-09-24 14:17:59
【问题描述】:
我正在使用 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? -
当我尝试第一个结帐命令致命时,我收到相同的消息消息:无法更新路径并同时切换到分支“主”。您是否打算签出无法解析为提交的“origin/master”?
-
然后尝试,在子模块中:
git branch -b master ; git reset --hard origin/master(如stackoverflow.com/a/17137740/6309)。但如果它仍然抱怨origin/master,那么该子模块的遥控器可能不正确。git remote -v返回什么?实际 repo/path/to/myrepo.git中是否有 master 分支? -
我验证了实际的 repo 有一个 master 分支。当我在子模块目录中运行
git remote -v时,我得到origin /path/to/sub/module.git/ (fetch)origin /path/to/sub/module.git/ (push)但仍然收到关于原始主机的相同错误 -
git branch -avvv返回什么(在子模块中)?你在分支列表中看到origin/master吗?
标签: git git-submodules