Cannot remove submodule from Git repo

This question already has an answer here:

  • How do I remove a submodule?

    21 answers

  • Git push Failed to connect to gitlab.com port 443: Bad access
  • Subversion: stage files to commit explicitly?
  • Git pre-commit hook to check spurious spaces
  • Git and WordPress (+ managing plugins and media)
  • Pull in changes from a Github fork
  • How to show all repos one has access to on origin?
  • How to manage repositories on GitHub
  • GIT restore last detached HEAD
  • Git launches mergetool without any arguments
  • Git accidentally deleted all of my changes
  • Can I replace a Git repo with its backup?
  • GIT 1.9 - remote: error: 'receive.denyCurrentBranch'
  • 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 https://stackoverflow.com/a/1789374/1798394 :

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