1. 下载安装 Node
Node官网,一步步安装即可
2. 安装 Git
3. 申请 GitHub(用户名为 username ),配置 SSH Keys
创建仓库,名字固定:username.github.io
4. 安装 HEXO
打开Git Bash
, 执行
1 | sudo npm install -g hexo |
如果不行,执行
1 | npm install -g cnpm --registry=https://registry.npm.taobao.org |
然后安装,执行
1 | npm install hexo -g |
5. 创建一个文件夹 blog ,在文件夹内 Shift + 右键打开命令窗口
执行
1 | hexo init |
再执行
1 | hexo generate |
(hexo g 也可以)
6. 启动 HEXO
执行
1 | hexo server |
浏览器输入 http://localhost:4000
即可打开
7. 修改 blog 下 _config.yml
最下方修改为
1 | type: git |
然后
执行
1 | npm install hexo-deployer-git --save |
执行
1 | hexo deploy |
现在查看 github 仓库,你会发现已经有很多文件了
在浏览器打开 https://username.github.io/
即可访问
8. 常用命令
部署
1 | hexo clean |
其他
1 | hexo new "postName" #新建文章 |
case:创建一片博文
1 | 1. hexo new "title" |