0

I'm trying to remove a single submodule from the repository. After submodule was removed from .gitmodule I started getting an exception message fatal: No url found for submodule path

Output of git status is

On branch task/My-task
Your branch is up to date with origin/task/My-task

.gitmodules content is

[submodule "MySubmodule"]
    path = MySubmodule
    url = ../MySubmodule.git
1615903
  • 32,635
  • 12
  • 70
  • 99
  • https://stackoverflow.com/a/1260982/7976758 Found in https://stackoverflow.com/search?q=%5Bgit-submodules%5D+remove – phd Mar 29 '23 at 17:11

1 Answers1

0

First of all find submodule path with the git submodule command. The second step is to remove all the references to this submodule with commands called one-by-one:

  1. git submodule deinit {submodule path}.
  2. git rm --cached {submodule path}.
  3. Remove a folder with the submodule. That's all. All that's left to do is commit the changes.
  4. git config --remove-section submodule.{submodule path}

Ex:

  1. git submodule deinit MySubmodule
  2. git rm --cached MySubmodule.
  3. git config --remove-section submodule.MySubmodule