Pre-requisite:
my two github user.name is miqianmimi & miqianmimi7
my two github user.email is miqainmimi@outlook.com & miqianmimi7@outlook.com
First: generate two keys and four documents.
1 | ssh-keygen -t rsa -C "miqainmimi@outlook.com" |
when enter name , you may use1
2id_rsa_one
id_rsa_two
when enter password , you may use space (set none password)
After this first part, you have 4 documents
1 | 1. id_rsa.one |
Second: add public and private keys.
1 | ssh-agent -s |
After this first part, you have already added the Public key and Private key
Third: rewrite your config
1 | touch config |
This is the config content
1 | #miqianmimi account |
After this part, you have finished a config document.
Forth: deploy SSH Key
Go into the your two github accounts and than go to Personal settings –> SSH and GPG keys
copy the key From1
2id_rsa.one.pub
id_rsa.two.pub
To your two github keys.
After this part, you have related your two github accounts with your two SSH keys.
Fifth: test whether they are linked
1 | ssh –T github.com-one |
When it is success: it will show that : the key on the github change from to
After this part, There is only one thing left.
Sixth: Clone you repo and modify your Git config
use first account : clone your repo and change git config like
1 | git clone git@github.com-one:miqianmimi/pingmesh-graduate-project-2018.git |
Then, the git add . & git commit a & git push are all right.
use second account : clone your repo and change git config like
1 | git clone git@github.com-two:miqianmimi7/so-high.git |
Then, the git add . & git commit a & git push are all right.
Reference :