title: Add a submodule which can't be removed from the index
body: <p>I'm trying to add a submodule that already existed (different git remote repository). As I didn't searched before how to do it correctly, I think I've messed up my repository and I need some help to fix it again.</p>
  
  <p>I've already deleted all the relevant sections from the .gitmodules and .git/config regarding the submodules I want to delete. I've also verified that there is not modules directory inside my .git/ directory.</p>
  
  <p>However, when I run the command <code>git rm --cached path_to_submodule</code>, the following message is displayed:</p>
  
  <pre>
  fatal: pathspec 'path_to_submodule' did not match any files
  </pre>
  
  <p>As the previous command fails, when I try to add again the same submodule with the new definitions, running the command <code>git submodule add gituser@host:repo.git</code>, this is the displayed message:</p>
  
  <pre>
  'repo' already exists in the index
  </pre>