一般备份hexo目录是,发现主题并没有提交上去,如下图:
解决方式如下:
-
git rm --cached themes/next/
rm 'themes/next'
-
git status
On branch master Your branch is up to date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) deleted: themes/next Untracked files: (use "git add <file>..." to include in what will be committed) themes/
-
git add themes/next/
-
git status
On branch master Your branch is up to date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) deleted: themes/next new file: themes/next/.all-contributorsrc new file: themes/next/.editorconfig new file: themes/next/.eslintrc.json new file: themes/next/.gitattributes` ......
-
git commit -m “备份next主题”
[master 2386fe5] 备份next主题 347 files changed, 27937 insertions(+), 1 deletion(-) delete mode 160000 themes/next create mode 100644 themes/next/.all-contributorsrc create mode 100644 themes/next/.editorconfig ......
-
git push origin master
Enumerating objects: 418, done. Counting objects: 100% (418/418), done. Delta compression using up to 4 threads Compressing objects: 100% (400/400), done. Writing objects: 100% (416/416), 761.18 KiB | 3.49 MiB/s, done. Total 416 (delta 27), reused 0 (delta 0) remote: Resolving deltas: 100% (27/27), completed with 1 local object. To https://github.com/jiaoht/HexoDemoBac.git e495fcb..2386fe5 master -> master
----------------The end----------------------------
延伸问题
- 如果使用自己的域名替换 username.github.io后,hexo再次生成部署后,会将dns服务商提供的CNAME删除掉,所以需要将它重新加到git项目中,还有一种简单的办法就是将CNAME加到hexo项目的source中,直接渲染到git项目中。
github page:https://jiaoht.github.io/2019/08/13/Hexo-%E4%B8%BB%E9%A2%98%E5%A4%87%E4%BB%BD%E9%97%AE%E9%A2%98/