一、使用hexo deploy部署博客到Github
使用参考
** 先安装个扩展$ npm install hexo-deployer-git --save
**
1.修改博客根目录下的_config_yml
文件

1 2 3 4 5 6
|
deploy: type: git repo: [email protected]:yeshan333/yeshan333.github.io.git branch: master
|

2.部署到GitHub repo
生成ssh keys
1
| ssh-keygen -t rsa -C "邮件地址@youremail.com"
|

将生成的ssh keys添加到Github的deploy keys中
** 这里用到.ssh目录下,id_rsa.pub文件中的那串key**

- 到GitHub的yourname.hithub.io仓库添加那串key到deploy keys中


部署博客
- 先配好git用户信息
1 2
| git config --global user.name "你的名字" git config --global user.email "邮箱@邮箱.com"
|
- 部署博客到仓库
访问https://yourname.github.io查看结果
** 到此,整个博客搭建完成了 **
以下是写的是博客主题的更换,主题可以自己写,也可以使用别人写的,可去这里https://hexo.io/themes/找喜欢的主题,如果使用的是别人的主题,需要阅读主题使用文档进行相关配置。
二、Hexo主题设置
cd进themes目录
1 2
| cd themes git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia
|
1 2
| cd themes/yilia git pull #更新主题
|

1 2 3
| hexo clean hexo g hexo s
|
去http://localhost:4000预览,没毛病就hexo d
部署到远程仓库。