Git 配置 SSH 公钥
- 本文默认会基本使用 Hexo(或其它静态博客框架) 并能成功运行(哪怕是demo)。 不会的点击学习 Hexo官方
- 本文默认已经创建 Gitee/GitHub 帐号 没有的去认证
- {name}: 你的GitHub/Gitee帐号名称
- {email}: 你的GitHub/Gitee邮箱
- 配置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
|
- 生成ssh公钥
生成ssh公钥1
| ssh-keygen -t rsa -C "thatcoder@163.com"
|
- 查看ssh公钥
添加ssh公钥1
| cat ~/.ssh/id_rsa.pub | pbcopy
|
- 添加ssh公钥
- 测试ssh 测试ssh
创建Git仓库
创建一个放置博客框架生成产物的仓库,比如叫 {name}.github.io
博客配置Git仓库
- 安装依赖
安装依赖1
| npm install hexo-deployer-git --save
|
- 修改博客配置
_config.yml1 2 3 4 5 6 7 8 9
| deploy: type: 'git' repository: github: git@github.com:ThatCoders/{name}.github.io.git
branch: github: master
message: 自动提交
|
- 测试
构建推送1 2
| hexo c && hexo g -d && hexo s
|
部署方式
根据自己喜好选择一个托管平台,也能自己服务器部署。