Cannot remove submodule from Git repo

This question already has an answer here:

  • How do I remove a submodule?

    21 answers

  • What is the best way to clone branches after cloning just trunk in git-svn?
  • Commands handled by git-shell on prompt don't do anything (just hangs)
  • Running command with with space argument value with apache command line
  • Is there a “more” command that can be used in the Git shell in windows?
  • How to build project from Github? Instructions inconclusive
  • Converting cloned git repositories into submodules
  • Is deleting old branches in Git submodules safe w.r.t. usable history of 'supermodules'?
  • How to fix language-level with deploy java heroku
  • Merge repos while overwriting changes
  • How to restore Git bare repository from local one
  • Passwords in git tree + Heroku + Github
  • Gerrit: Merged, Outdated
  • 2 Solutions collect form web for “Cannot remove submodule from Git repo”

    If the git submodule deinit fails (maybe because the .gitmodules doesn’t list that submodule), try to remove at least the special entry in the index:

    git rm --cached submodule-name
    git commit -m "Remove submodule entry"
    git push

    The gray folder should then be gone on GitHub side.

    This worked :

    git rm --cached path/to/submodule
    rm -rf path/to/submodule
    Git Baby is a git and github fan, let's start git clone.