Git submodule add: “a git directory is found locally” issue

Git submodule add: “a git directory is found locally” issue 解決方法

參考鏈接: https://stackoverflow.com/questions/20929336/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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章