在hexo中使用了从其他仓库拉取的主题后进行git提交的过程中,会出现如下警告:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
warning: adding embedded git repository: themes/[theme-name]
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint: git submodule add <url> themes/[theme-name]
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached themes/[theme-name]
hint:
hint: See "git help submodule" for more information.

此时需要按照提示先删除该主题文件夹的缓存

1
git rm --cached themes/[theme-name]

如果无法删除,则使用强制删除命令

1
git rm --cached -f themes/[theme-name]

然后将该主题文件夹作为子索引添加到暂存区

1
git submodule add <url> themes/[theme-name]

即可进行后续操作

若直接提交记录无视警告,则会导致自动部署时发生未找到外部主题文件夹索引的错误。