关于github:无法从Git repo中删除子模块

Cannot remove submodule from Git repo

本问题已经有最佳答案,请猛点这里访问。

我有一个Git回购的子项目,我想删除,但无法删除。在Github Web界面上,子模块显示为黑色(或灰色)文件夹图标,不可单击。

submodule in git repo。

该文件夹存在一些问题,即使本地代码在该文件夹中有文件,并且我将其推送到我的存储库中,更改也不会应用于GitHub远程。不知何故,此文件夹被忽略。我查了一下,它不在.gitignore文件中。

在尝试删除我使用的子项目时:

1
git submodule deinit submodule-name

但它给出的错误是

error: pathspec 'submodule-name' did not match any file(s) known to git.
Did you forget to 'git add'?

号

这里有什么问题?


If the git submodule deinitfails(maybe because the .gitmodulesdoesn't list that submodule),try to remove at least the special entry in the index:

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

灰色的狐狸应该在吉他边上。


This worked https://stackoverflow.com/A/1789374/1798394:

ZZU1