當你在公司的一臺電腦上成功部署完hexo而且發表一篇博客時,彆着急激動!有沒有想過回家後還想用hexo怎麼辦呢?git
思路:在生成的已經推到github上的hexo靜態代碼上簡歷一個分支,利用這個分支來管理本身的hexo源文件github
git clone https://github.com/zine-fj/zine-fj.github.io.git
hexo init
初始化。touch .gitignore
git checkout -b hexo # 切換分支 git checkout hexo # 查看分支 git branch
git add . git commit -m "新建分支" git remote add origin https://github.com/zine-fj/zine-fj.github.io.git git push -u origin hexo
git clone -b hexo https://github.com/zine-fj/zine-fj.github.io.git hexo
hexo -v
查看hexo是否可用。若不可用則根據提示安裝(注意:用cnpm安裝可能會有問題)npm i hexo --save
yarn
在本地查看示例(localhost:4000) hexo g hexo s hexo new post "title" hexo d -g
hexo d -g
部署沒有成功並顯示 Host key verification failed
則說明本地電腦沒有ssh祕鑰(個人作法是再創建一個祕鑰)git push
把源文件推到分支上hexo s
查看 localhost:4000 是空白的話,多是由於沒有獲取到主題(主題在 themes
文件夾中)。