A git directory for 'xx' is found locally with remote(s):
origin git@gitlab.com/xx.git
If you want to reuse this local git directory instead of cloning again from
git@gitlab.com/xx.git
use the '--force' option. If the local git directory is not the correct repo
or you are unsure what this means choose another name with the '--name' option.
解决方法如下:
1.在主项目目录下打开命令行工具执行命令 git rm --cached 删除指定模块的文件
2.打开主项目目录下 .gitmodules (可能会隐藏,需要显示设置)文件 删除如下类似内容
[submodule "xx"]
path = xx
url = https://github.com/xx
3.打开主项目目录下 .git/config 文件 删除如下内容:
[submodule "xx"]
url = https://github.com/xx
4.使用命令行工具执行命令:rm -rf .git/modules/xx 删除.git下的缓存模块,也可找到对应文件直接删除
执行上述操作后 重新执行git submodule add -b master --name repoName repoUrl path 即可
-b 指定子仓库分支
-name 指定子仓库名称
repoUrl Git地址
path 子仓库要存储的位置
子仓库执行
git submodule init
git submodule update
网友评论