1.下载安装nodejs
2.安装git
3.通过git命令窗口
npm install -g cnpm --registry=https://registry.npm.taobao.org
4安装hexo框架
cnpm install hexo-cli -g 安装hexo框架
hexo -v 查看hexo的版本
5.创建博客目录
在window新建blog目录
E:/github/Myblog
6.进入E:/github/Myblog文件夹下执行
初始化,生成博客文件
hexo init
7.启动博客
本地运行hexo博客
hexo server
8.安装
安装git,发布到github上
cnpm install --save hexo-deployer-git
9.注册github账号
10.建个仓库username.github.io
11.进入-config.yml
注意:每次上传博客,都需要输入账号密码
追加:
deployer
type: git
repo: https://github.com/liuwumin/liuwumin.github.io.git
branch: master
12.部署到github
hexo clean && hexo deploy
13.免账号密码发布博客
13.1 生成公钥
13.2 找到公钥文件,打开并复制
13.3 登录github,找到setting,创建ssh秘钥
13.4 修改blog目录文件_config.yml
deploy:
type: git
repository: git@github.com:你的github账户/你的github账户.github.io.git
branch: master
13.5 进入git设置用户名和邮箱
git config --global user.email “you@example.com”
git config --global user.name “Your Name”
14.写博客并发布
14.1 进入source/_posts目录下创建文件写
14.2 启动git(鼠标右击),
hexo clean 清除上次上传博客的缓存
hexo g 生成静态网页
hexo d 发布到github