利用hexo+github搭建自己的blog

创建仓库

仓库名必须是username.github.io

本地git配置ssh

此操作已经完成,掠过。

hexo安装与配置

安装

1
2
$ brew install node
$ npm install -g hexo

初始化

1
2
$ cd **/username.github.io/
$ hexo init

配置_config.yml

1
2
3
4
deploy:
type: git
repository: git@github.com:username/username.github.io.git
branch: master

安装插件

npm install hexo-deployer-git --save

不装的话会报错

Deployer not found: github 或者 Deployer not found: git

使用

1
2
3
4
5
hexo clean //每次改写完之后都要hexo clean 一下,太麻烦。
hexo g //生成,generate
hexo s //本地部署,server
hexo d //部署到github,deploy
hexo d -g //组合命令

参考网站