七寸殇

  • 主页
  • 随笔
所有文章 友链 关于我

七寸殇

  • 主页
  • 随笔

使用Hexo建立博客

2017-12-19

1、下载并安装git

https://git-scm.com/downloads

2、下载并安装nodejs

https://nodejs.org/en/

3、安装配置hexo

  • 如果提示没有npm命令,则是nodejs的npm环境变量没有配置,安装nodejs的时候选择默认配置环境变量即可。

    1
    npm install -g hexo
  • 初始化hexo

    1
    hexo init
  • 配置_config.yml和主题安装详见其它文章

    1
    2
    hexo n firstblog #新建文章
    hexo new page firstpage #新建页面

>>更多Hexo命令

4、配置GitHub

  • 如果没有github账户请先创建;
  • 点击右上角加号,选择New repository
  • 填写yourname.github.io,例如qicunshang.github.io,点击创建
  • 记住仓库地址,并点击setting找到Github pages设置主题

5、GitHub和Hexo建立联系

  • 打开git bash here,设置git的username和email

    1
    2
    git config --global user.name "qicunshang"
    git config --global user.email "lsreal@qq.com"
  • 生成秘钥以便ssh登录上传代码

    1
    ssh-keygen -t rsa -C "lsreal@qq.com"

遇到Enter file in which to save the key (/c/*/.ssh/id_rsa): 直接回车
提示输入两次passphrase,可以为空

  • 秘钥生成之后会创建id_rsa、id_rsa.pub文件
  • 点击用户中心setting页面的SSH and GPG keys,然后选择New SSH Key,title随便写,key填id_rsa.pub文件的内容即可
  • 配置_config.yml的Deployment部分,修改:
    1
    2
    3
    4
    deploy:
    type: git
    repo: git@github.com:qicunshang/qicunshang.github.io.git
    branch: master

注意repo修改为自己的仓库地址

  • 安装扩展
    1
    npm install hexo-deployer-git --save

如果没有安装可能会提示ERROR Deployer not found: git

  • 生成、部署
    1
    2
    hexo g   #生成
    hexo d #部署

部署成功即可通过youname.github.io查看你的博客了!

赏

谢谢你请我吃糖果

支付宝
微信
  • hexo
  • blog
  • github

扫一扫,分享到微信

微信分享二维码
用wxParse解析微信小程序富文本
© 2023 七寸殇
总访问量:, 页面访问量
  • 所有文章
  • 友链
  • 关于我

tag:

  • composer
  • 镜像
  • laravel
  • ab.exe
  • 性能测试
  • apache
  • 交换变量
  • 面试题
  • 位运算
  • 阿里云
  • git
  • django
  • python
  • hexo
  • blog
  • github
  • docker
  • docker-compose
  • eclipse
  • tomcat
  • 环境变量
  • requests
  • api
  • php
  • 下载完成
  • mysql
  • 数据库
  • 脏读
  • 不可重复读
  • 幻读
  • merge
  • 分支
  • 合并
  • abort
  • push
  • remote
  • pull
  • .gitignore
  • reset
  • hooks
  • redis
  • appends
  • 分页
  • paginate
  • header
  • response
  • linux
  • php7
  • nginx
  • 500错误
  • php.ini
  • display_errors
  • Auth
  • guard
  • session
  • 路由
  • route
  • validate
  • 验证
  • group_concat
  • concat
  • raw
  • 数据库查询
  • 一对多
  • 笛卡尔集
  • lnmp
  • find
  • 远程登录
  • 忘记密码
  • ThinkPHP
  • url重写
  • 路由重写
  • proxy_pass
  • 反向代理
  • foreach
  • 最后一个元素
  • get_cfg_var
  • ini_set
  • ini_get
  • ini_get_all
  • ini_restore
  • 反射
  • 类的所有方法
  • 命名规范
  • 闭包
  • 引用
  • pytesser
  • 图片识别
  • windows
  • tesseract-ocr
  • RESTful
  • 无状态
  • Statelessness
  • selenium
  • phantomjs
  • 爬虫
  • svn
  • 微信小程序
  • wxParse
  • 微信
  • 成语猜猜看
  • vagrant
  • while
  • 素数
  • 算法
  • ssh
  • setData
  • 上拉加载
  • log
  • 闲鱼
  • html

    缺失模块。
    1、请确保node版本大于6.2
    2、在博客根目录(注意不是yilia根目录)执行以下命令:
    npm i hexo-generator-json-content --save

    3、在根目录_config.yml里添加配置:

      jsonContent:
        meta: false
        pages: false
        posts:
          title: true
          date: true
          path: true
          text: false
          raw: false
          content: false
          slug: false
          updated: false
          comments: false
          link: false
          permalink: false
          excerpt: false
          categories: false
          tags: true
    

Make More Time