Hexo主題備份問題

一般備份hexo目錄是,發現主題並沒有提交上去,如下圖:
hexo主題備份問題
解決方式如下:

  1. git rm --cached themes/next/

     rm 'themes/next'
    
  2. 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/
    
  3. git add themes/next/

  4. 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`
     		......
    
  5. 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
      ......
    
  6. 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/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章