【Hexo】03-Hexo部署至Github

img-35

【Hexo】Hexo部署至Github

Github配置ssh

  1. 生成ssh
    ……………………………………………………………………………………………………………………

  2. 给github配置ssh

    1. 登陆后在GitHub主页选择Settings,进入设置页面。
      img-36
  3. 选择SSH and GPG keys
    img-37

  4. 输入生成的.pub文件

    img-38

  5. 提交成功

    img-39

Github创建repository

仓库名称格式固定为{username}.github.io

  1. 新建repository。选择Repoisitories -> New

    img-40

  2. 创建Repository

    img-41

  3. 创建成功

    img-42

Hexo配置Github项目地址

  1. /_config.yml修改配置文件

    在配置文件末尾添加如下配置。

    1
    2
    3
    4
    5
    6
    # Deployment
    ## Docs: https://hexo.io/docs/one-command-deployment
    deploy:
    type: git
    repository: git@github.com:201619918/201619918.github.io.git
    branch: master

    repository地址为SSH的地址

    img-43

  2. npm install hexo-deployer-git --save安装依赖

    img-44

  3. hexo clean

    hexo g -d:生成静态文件,并部署至github中。

    img-45

  4. 201619918.github.io

    部署成功

    img-46

配置域名

  1. 查看域名201619918.github.io的IP地址185.199.111.153

    ping 201619918.github.io

    img-54

  2. 解析域名到该IP地址185.199.111.153

    img-55

  3. 在项目根路径下创建文件CNAME

    img-56

  4. hexo g -d将网站重新部署

    img-57

  5. https://github.com/201619918/201619918.github.io配置域名

    img-58

    img-59

  6. blog.zsqbigbig.cn访问

    img-60

    访问成功

-------------本文结束感谢您的阅读-------------