记录一下如何同时将hexo部署到github和个人ubuntu服务器
记录一下如何同时将hexo部署到github和个人ubuntu服务器
1、申请秘钥对的时候需要指定位置和名称
1 | ssh-keygen -t rsa -C "eystasy@gmail.com" -f C:\Users\Colar\github\my_ssh_key |
说明:
-t 表示选择加密方式。
-c 表示用户,通常填写邮箱表示
-f 指定秘钥保存路径,最后的“my_ssh_key”表示秘钥名称
2、用notepad等软件打开.pub的公钥,复制后粘贴到github的SSH key的位置。具体见图。


3.配置config文件
1 | 路径:C:\Users\Colar\.ssh |
config配置
1 | Host github.com |
将
C:/path/to/your/private_key
替换为你的私钥文件的实际路径。注意路径使用正斜杠(/)或双反斜杠(\)。Host
可以是任何你想要的别名,如果你连接的是GitHub,通常直接使用github.com
。HostName
是Git服务器的地址,对于GitHub,它就是github.com
。User
是SSH连接中使用的用户名,对于GitHub而言,通常是git
。IdentitiesOnly yes
确保SSH只使用指定的IdentityFile
。运行下列代码检测连通性:
ssh -T git@github.com
ssh -vT git@github.com1
2
3
4
5

或者下面的代码(区别是有错误输出):deploy:1
2
3
4
5

### 4.hexo中的_config主文件中进行相关修改type: git
repo:
branch:type: heroku
repo:
branch:1
2
3
##### 因为我是用的nginx proxy manager管理网站,所以同时采用了git链接和ssh链接,附上个人部署方案:deploy:
- type: git
repo: ssh://root@111.111.111.111:/home/git/blog
branch: master - type: git
repo: git@github.com:Eystasy/eystasy.github.io.git
branch: master
- type: git
### 5.尝试部署,注意看是否部署两次,即可判定是否成功。


### 6.至此成功解决问题,这个问题都花了好几个小时才解决。记录一下,以被不时之需。
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 伊哥の分享!