Alley23 Notes

平常心、、、


  • 首页

  • 归档

hexo搭建博客及GitHub部署

发表于 2017-07-05 | 分类于 hexo

一、安装hexo

  1. 全局安装hexo
1
$ cnpm install hexo -g
  1. 创建文件夹并初始化
1
$ hexo init

3.安装依赖

1
$ cnpm install

4.生成静态文件、启动服务

1
2
$ hexo g   //生成静态文件
$ hexo s //开启服务器
  • 问题:假如页面一直无法跳转,那么可能端口被占用了。此时我们ctrl+c停止服务器,接着输入“hexo server -p 端口号”来改变端口号
1
$ hexo server -p 8888
  1. 新建一篇博客
1
$ hexo new post “我的第一篇GitHub博客”

二、创建github仓库及部署

  1. Github新建项目,项目必须要遵守格式:名称.github.io

    1
    aa.github.io
  2. 修改_config.yml配置文件

1
2
3
4
deploy:
type: git //git
repository: git@github.com:Alley23/alley.io.git //GitHub仓库地址
branch: master //分支

3.安装hexo-deployer-git自动部署发布工具

1
$ cnpm install hexo-deployer-git  --save

4.发布到Github

1
2
3
4
$ hexo clean && hexo g && hexo d
//clean清除缓存文件 (db.json) 和已生成的静态文件 (public)
//g 生成静态文件
//d 部署网站

三、问题解决

  • 在执行hexo deploy的时候一直出现ERROR Deployer not found: git。
    1
    $ cnpm install hexo-deployer-git --save

hexo指令

12

小凯

11 日志
4 分类
4 标签
© 2018 小凯
由 Hexo 强力驱动
|
主题 — NexT.Muse v5.1.4