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

后端 未结 6 1316
南旧
南旧 2020-12-22 15:10

I\'m actually trying to learn how to use git, including the git submodule subcommands. I already set up a server on which I can host, push and pull git reposito

6条回答
  •  醉酒成梦
    2020-12-22 15:39

    I came to this SO post trying to add a submodule with the same path as a submodule that I recently deleted.

    This is what ultimately worked for me (this article helped out a lot):

    If you haven't already run git rm --cached path_to_submodule (no trailing slash) as well as rm -rf path_to_submodule, do that!

    Then:

    1. Delete the relevant lines from the .gitmodules file. e.g. delete these:

      [submodule "path_to_submodule"] path = path_to_submodule url = https://github.com/path_to_submodule

    2. Delete the relevant section from .git/config. e.g. delete these:

      [submodule "path_to_submodule"] url = https://github.com/path_to_submodule

    3. rm -rf .git/modules/path_to_submodule

    Then, you can finally:

    git submodule add https://github.com/path_to_submodule

提交回复
热议问题