重新添加git 子模块出现的问题:
A git directory for 'formRenderLib' is found locally with remote(s):
origin git@gitlab.com:newcare/formRenderLib.git
If you want to reuse this local git directory instead of cloning again from
git@gitlab.com:newcare/formRenderLib.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.
说明没有删除干净之前的module
解决方法:
在主项目目录下打开命令行工具执行命令
git rm --cached path_to_submodule
删除指定模块的文件打开主项目目录下 .gitmodules (可能会隐藏,需要显示设置)文件 删除如下类似内容:
mac下使用命令vim .gitmodules
可打开vim编辑[submodule "path_to_submodule"] path = path_to_submodule url = https://github.com/path_to_submodule
打开主项目目录下 .git/config 文件 删除如下内容:
同样可使用vim编辑[submodule "path_to_submodule"] url = https://github.com/path_to_submodule
使用命令行工具执行命令:
rm -rf .git/modules/path_to_submodule
删除.git下的缓存模块
最后使用如下命令即可添加子模块 git submodule add https://github.com/path_to_submodule