Git is not tracking Hexo theme file

Viewed 437

I have set up a Hexo blog and it is working good. I am trying to make a backup for my local file and I am doing this by upload the file to GitHub.(Not hosting the page, as I have done that) However, there is an issue when I stage the file.

enter image description here

As far as I know, the themes/icarus stores the theme file I am using for my blog AND this file is not tracking file. I have checked my .gitignore file, it looks like this:

enter image description here

How to fix this issue, Thanks in advance.

3 Answers

Modified content, untracked content means that themes/icarus folder is a submodule.

Check your .gitmodules file, you should see it there.

If you do any modification in a submodule, you must add, commit and piush in that submodule first (assuming you can push to its remote repository), before adding/committing and pushing in the main project.

If a file is not staged in Git, it means you have not added it to be included by the next commit. Try git add themes/icarus or git add -A, before you commit. This should stage the file.

I had exactly the same problem with you and I solved this by running following commands.

  1. Make sure you already removed .git/ for every submodule directories.
git rm -rf .git
  1. Remove cached files in root directory of git repo
git rm -r --cached .
  1. Add and commit all files again
git commit -am 'commit message'
Related