无状态部署通用负载均衡方案
钟意关于负载均衡的笔记

Git 配置 SSH 公钥

  • 本文默认会基本使用 Hexo(或其它静态博客框架) 并能成功运行(哪怕是demo)。 不会的点击学习 Hexo官方
  • 本文默认已经创建 Gitee/GitHub 帐号 没有的去认证
  • {name}: 你的GitHub/Gitee帐号名称
  • {email}: 你的GitHub/Gitee邮箱
  1. 配置ssh账户与邮箱
    本地Git账号配置
    1
    2
    3
    4
    5
    6
    7
    # 配置邮箱与用户名
    git config --global user.email {email}
    git config --global user.name {name}

    # 查看邮箱与用户名
    git config --global user.name
    git config --global user.email
  2. 生成ssh公钥
    生成ssh公钥
    1
    ssh-keygen -t rsa -C "thatcoder@163.com" # 一直回车
  3. 查看ssh公钥
    添加ssh公钥
    1
    cat ~/.ssh/id_rsa.pub | pbcopy
  4. 添加ssh公钥
  5. 测试ssh
    测试ssh
    1
    2
    3
    ssh -T git@github.com
    # 测试成功
    # Hi thatcoder! You've successfully authenticated, but GitHub does not provide shell access.

创建Git仓库

创建一个放置博客框架生成产物的仓库,比如叫 {name}.github.io

博客配置Git仓库

  1. 安装依赖
    安装依赖
    1
    npm install hexo-deployer-git --save
  2. 修改博客配置
    _config.yml
    1
    2
    3
    4
    5
    6
    7
    8
    9
    deploy:
    type: 'git'
    repository:
    github: git@github.com:ThatCoders/{name}.github.io.git
    # gitee: git@gitee.com:thatcoder/thatcoder.git
    branch:
    github: master
    # gitee: master
    message: 自动提交
  3. 测试
    构建推送
    1
    2
    hexo c && hexo g -d && hexo s
    # 创建的仓库会接收到推送,覆盖仓库内容

部署方式

根据自己喜好选择一个托管平台,也能自己服务器部署。


本站由 钟意 使用 Stellar 1.30.4 主题创建。
又拍云 提供CDN加速/云存储服务
vercelnetlifycloudflare 提供托管服务
湘ICP备2023019799号-1
总访问