Git submodule add: “a git directory is found locally” issue 解決方法
問題描述:
當添加一個最近剛被刪除的同名submodule時會提示:Git submodule add: “a git directory is found locally” issue
解決方法:
首先:
git rm --cached path_to_submodule
rm -rf path_to_submodule
然後:
刪除.gitmodules文件中的對應行:
[submodule "path_to_submodule"]
path = path_to_submodule
url = https://github.com/path_to_submodule
刪除.git/config文件中的對應行:
[submodule "path_to_submodule"]
url = https://github.com/path_to_submodule
rm -rf .git/modules/path_to_submodule
最後即可重新添加submodule:
git submodule add https://github.com/path_to_submodule