Step 1
生成第二個key,取名作id_rsa_second
其馏,并將key添加到第二個github賬戶中
# Generate new ssh keys
$ cd ~/.ssh
# You should see there is already a ssh key, id_rsa.pub
$ ssh-keygen -t rsa -C "yourSecondEmail@email.com"
·
# Give your second ssh key another name: e.g., id_rsa_second
Generating public/private rsa key pair.
Enter file in which to save the key (c/Users/zhuyi/.ssh/id_rsa):
$ id_rsa_second
Step 2
將第二個key添加入代理
$ ssh-add ~/.ssh/id_rsa_second
如果執(zhí)行失敗可以嘗試
$ ssh-agent bash
$ ssh-add ~/.ssh/id_rsa_second
Step 3
在~/.ssh
找到config
文件秦士,如果沒有就自己添加一個,在config文件里添加
# Default Github User (yourFirstEmail@mail.com)
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
# Second Github User (yourSecondEmail@mail.com)
Host git2
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_second
# git2 is the alternative name of your second Github account, you can use it when you clone or update your project. Details can be found later.
Step 4
前往你的第二個hexo博客地址蝇更,修改_config.yml
配置
deploy:
type: git
repo: git2:xxx/xxx.github.io.git
branch: master
添加完嘗試執(zhí)行hexo g
玫恳、 hexo d
即可穷吮。