一般備份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/