安装hexo
安装hexo之前需要将hexo和git(macOS系统自带)安装好
使用npm安装hexo1
npm install -g hexo-cli
初始化并部署hexo博客1
2
3
4hexo i blog //init的缩写 blog是项目名
cd blog //切换到站点根目录
hexo g //generetor的缩写
hexo s //server的缩写
打开浏览器输入localhost:4000查看
主题文件安装在themes文件夹下 可从github找自己喜欢的博客主题
配置github page
在github创建用户名.github.io的仓库,在setting中配置page信息
配置ssh
生成ssh rsakey1
2
3
4
5
6
7cd .ssh
$ ssh-keygen -t rsa -C "yourmail@mail.com"
#全部Enter不用设置密码
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/xxx/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
将rsakey复制到github 验证是否联通1
$ ssh -T git@github.com
修改用户名和邮箱1
2$ git config --global user.name "用户名"
$ git config --global user.email "邮箱"
部署到github
1 | npm install hexo-deployer-git --save |
参考文章
用Hexo + github搭建自己的博客 — 再也不用羡慕别人了!
20分钟教你使用hexo搭建github博客