hexo和GitHub搭建个人博客

一. GitHub创建仓库地址

1.在GitHub上Create a new repository

2.Repository name 填写 yourname.github.io (yourname与你的注册用户名一致, 这个就是你博客的域名了)

二. 环境安装

1.安装node

node官网

2.安装git

3.安装Hexo

1
npm install -g hexo-cli

三. 博客搭建

1.进入到项目根目录

1
hexo init blog

2.成功后执行

1
2
3
hexo generate

hexo server

3.在浏览器输入 http://localhost:4000/ 就可以看见网页和模板了

4.接下来,把网页发布到GitHub上

1
ssh-keygen -t rsa -C "Github的注册邮箱地址"

5.配置博客

1
2
3
4
deploy: 
type: git
repo: https://github.com/xxx/xxx.github.io.git
branch: master

四. 发表文章

1
hexo new 'test'

打开test.md编辑一些内容,保存

1
2
3
4
5
hexo clean

hexo generate

hexo server

打开http://localhost:4000/,发现刚才的文章已经成功了

五. 最后一步,发布

1
hexo deploy

现在打开https://yourname.github.io/ 就可以看到你的博客了

六. 错误指南

如果遇到 error deployer not found:git

执行

1
npm install hexo-deployer-git --save

Google是你最好的老师

 上一篇

blog, Hexo