当你在公司的一台电脑上成功部署完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
文件夹中)。