git submodule: already exists in the index

注意
本文最后更新于 2024-01-11,文中内容可能已过时。

Git 报错 “git submodule: already exists in the index” 的解决方法。

1 问题

hugo-fixit/docs,里我增通过软连接的方式引入了 hugo-fixit/FixIt,位于 themes/FixIt 目录下。

然后为了把主题开发和主题文档分离(#404),我想通过 git submodule 的方式引入主题,于是我先把 themes/FixIt 目录删除,然后执行:

1
git submodule add https://github.com/hugo-fixit/FixIt.git themes/FixIt

结果报错:

1
fatal: 'themes/FixIt' already exists in the index

2 解决方法

1
git rm -r --cached themes/FixIt

相关内容

Buy me a coffee~
Lruihao 支付宝支付宝
Lruihao 微信微信
0%