Hexo同时托管GitHub和GitCafe

设置公私钥

因为我已经有了一套GitHub的公密钥,为默认的id_rsa,所以还需要生成GitCafe的公密钥,为避免冲突命名为gitcafe,这里我把GitCafe 官方帮助文档复制过来,步骤如下:

1. 生成新的 SSH 秘钥

记得把以下命令中的 [email protected]
改为你的 Email 地址

ssh-keygen -t rsa -C "[email protected]" -f ~/.ssh/gitcafe

2. 生成过程中会出现以下信息,按屏幕提示操作,并记得输入 passphrase 口令。

$ ssh-keygen -t rsa -C "[email protected]" -f~/.ssh/gitcafe

Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/username/.ssh/gitcafe.
Your public key has been saved in /c/Users/username/.ssh/gitcafe.pub.
The key fingerprint is:
15:81:d2:7a:c6:6c:0f:ec:b0:b6:d4:18:b8:d1:41:48 [email protected]

这将在 ~/.ssh/目录下生成 gitcafe和 gitcafe.pub文件,记住千万不要把私钥文件 gitcafe透露给任何人

3. 在 SSH 用户配置文件 ~/.ssh/config中指定对应服务所使用的公秘钥名称,如果没有 config 文件的话就新建一个,并输入以下内容:

Host gitcafe.com www.gitcafe.com
  IdentityFile ~/.ssh/gitcafe

4. 添加 gitcafe.pub中的内容到 GitCafe 网站。

具体请参考如何安装和设置 Git中的第三节。

5. 最后测试配置文件是否正常工作

ssh -T [email protected]

如果连接成功的话,会出现以下信息。

Hi USERNAME! You've successfully authenticated, but GitCafe does not provide shell access.

6. 完成

测试通过后,你就可以使用独立的一套公秘钥来使用 GitCafe 了。Enjoy!

设置Hexo配置文件_config.yml,修改如下:

deploy:
  type: git
  message: "xxxx"
  repo: 
    github: [email protected]:likino/likino.github.io.git,master
    gitcafe: [email protected]:likino/likino.git,gitcafe-pages

注意空格缩进

注意空格缩进

注意空格缩进

重要的话说三遍!

然后hexo d -g,设置完成,Enjoy!

万网域名双线解析

进入万网/阿里云后台,域名解析:

Hexo同时托管GitHub和GitCafe_第1张图片

添加两条CNAME,分别解析,解析路线选择默认至GitCafe,海外IP至GitHub。

完成!


最后来看看速度

Hexo同时托管GitHub和GitCafe_第2张图片

比之前GitHub将近300ms,提升了不少。:)

你可能感兴趣的:(Hexo同时托管GitHub和GitCafe)