我有一个git仓库在父文件夹中,我们称这个文件夹为 "root"。然后在文件夹中有一个子目录,我们称之为 "child"。我想做的是将远程仓库作为子模块克隆到 "child" 中:
git submodule add git@github.com:username/repopath child/
git submodule add git@github.com:username/repopath ./child/
以上两者都给了我以下错误:
child already exists in the index(子项已存在于索引中)
我尝试将目录从跟踪列表中删除:
git rm --cached .\child\*
git submodule add git@github.com:username/repopath child/
然后我遇到了这个错误:
'child'已经存在且不是有效的git仓库
任何帮助都将不胜感激
谢谢
git submodule add -- git@github.com:username/repopath child
。--
:两个短横线后面只有文件夹和文件,没有选项。git@githu...
是一个ssh
地址,而不是https
。 - Timo