Failed to execute "git add" on the Hexo project due to the theme submodule

date
Jun 9, 2022
slug
hexo-theme-submodule
status
Published
tags
Git
Hexo
Bugfix
summary
type
Post

Problem

I failed to git add . the source files of my Hexo blog project, and the error said:

What’s wrong

That was because inside this repository, I had cloned the theme files from another github repository.
So Git identifies the theme as a submodule.

Solution

To solve this problem, follow the steps below:
  1. Get to where the theme directory is, and remove the .git folder within it
    1. We can check if it’s removed successfully by listing out all the files within it:
  1. Remove cached files in root directory of our hexo project
    1. Add and commit all files again

      References


      © Foy Wan 2022 - 2025