1、github新建两个仓库,一个用来存放静态可访问的文件,这个仓库的名字必须是 用户名.github.io。另一个用来存放源码,用来随时随地写日志

2、配置github

git config --global user.name "你的GitHub用户名"
git config --global user.email "你的GitHub注册邮箱"

3、hexo

npm install -g hexo-cli 
hexo init blog
cd blog
npm install hexo-admin@2.3.0 –S   # web写日志
npm install hexo-deployer-git@3.0.0  # 部署静态文件到github

4、hexo 配置 _config.yml

deploy:
  type: 'git'
  repo: 'https://github.com/username/username.github.io.git'
  branch: 'master'


# hexo-admin authentification wangcj/wangcj@123456
admin:
  username: username
  password_hash: password_hash
  secret: secret

5、写日志流程

启动本地server,打开web写日志,发布

重新生成静态文件推送到github

6、域名解析

域名解析添加CNAME记录要花钱,然后https又要花钱,算了。



博客      hexo 博客

本博客所有文章除特别声明外,均采用 CC BY-SA 3.0协议 。转载请注明出处!