Cannot remove submodule from Git repo
Solution 1
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.
Solution 2
This worked https://stackoverflow.com/a/1789374/1798394 :
git rm --cached path/to/submodule
rm -rf path/to/submodule
Related videos on Youtube
Comments
-
Geek almost 2 years
I have a subproject in a Git repo that I want to remove but am not able to. On the GitHub web interface the submodules are shown with black (or grey) folder icons and are not clickable.
There are some issues with that folder that even if my local code has files in that folder and I push to my repository, changes are not applied on the GitHub remote. Somehow this folder is ignored. I checked that it is not in
.gitignore
file.On trying to remove the subproject I used:
git submodule deinit submodule-name
but it gives error that
error: pathspec 'submodule-name' did not match any file(s) known to git. Did you forget to 'git add'?
What's the issue here?
-
halex over 10 yearsTry removing the submodule this way
-
eckes over 10 yearsfor reference: the github icons could be found here: github.com/styleguide/css/7.0 The blue ones are used with class
.octicon-file-directory
the grey one is.octicon-file-submodule
, so I also guess that it's something submodule related.
-
-
Admin almost 8 years
fatal: pathspec 'submodule-name' did not match any files
-
VonC almost 8 years@frageDE Please ask a new question, with all relevant details (OS version, git version, ...)