2014-01-27 69 views
9

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

submodule in git repo

有一些问题,即使我的本地代码有文件夹在该文件夹,我把我的资料库,不应用更改GitHub的遥控器上。不知怎的,这个文件夹被忽略。我检查了它不在.gitignore文件中。

在试图消除我所用的子项目:

git submodule deinit submodule-name 

,但它给错误

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

这里有什么问题?

+1

尝试删除子模块[这样](http://stackoverflow.com/a/1260982/637284) – halex

+1

供参考:GitHub的图标可以在这里找到:HTTPS ://github.com/styleguide/css/7.0蓝色与''.octicon-file-directory'类一起使用,灰色的是'.octicon-file-submodule',所以我也猜测它是子模块相关的。 – eckes

+0

@random起初我甚至不知道具有不同图标的文件夹是子模块。我对此完全陌生。 – Geek

回答

21

如果git submodule deinit失败(也许是因为.gitmodules不会列出子模块),尝试删除至少special entrythe index

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

灰色的文件夹然后应在GitHub上跑掉了。

+0

'fatal:pathspec'submodule-name'不匹配任何文件' – 2016-05-31 11:52:42

+0

@frageDE请提出一个新问题,并附上所有相关详细信息(操作系统版本,git版本,...) – VonC