参考自:Hexo主题themes-文件夹无法提交到GitHub的解决方法

所遇问题

在 Github 上发现上传的博客文件唯独 主题文件 没有真正上传。通过百度了解到是因为 themes/anzhiyu 也是从仓库里拉取下来的,他关联到了作者的 git 仓库,所以才提交不上去

1
2
3
4
5
6
7
8
9
10
11
12
C:\Users\WeiLin\Desktop\weilin-liao.github (master -> origin)
λ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: themes/hexo-theme-icarus (modified content, untracked content)

no changes added to commit (use "git add" and/or "git commit -a")

解决方案

删除暂存区的该文件夹,其中 主题文件名 填写你自已的

1
git rm --cache themes/主题文件名

移除相应文件或文件夹,例如我将 themes/anzhiyu/.git 文件夹移动到桌面上去,同时 .gitignore 里的 _config 去掉

没有这些可以不用理会该步

通过 git status 查看当前状态

1
2
3
4
5
6
7
8
9
10
11
12
C:\Users\WeiLin\Desktop\weilin-liao.github (master -> origin)
λ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
(use "git restore --staged <file>..." to unstage)
deleted: themes/hexo-theme-icarus

Untracked files:
(use "git add <file>..." to include in what will be committed)
themes/