1. create multiple ssh key

ssh-keygen -t rsa -C "[email protected]"

for example, 2 keys create at:

1
2
~/.ssh/id_rsa
~/.ssh/id_rsa_sli_racingwithhorse

2. then, add these two keys as following

1
2
ssh-add ~/.ssh/id_rsa
ssh-add ~/.ssh/id_rsa_sli_racingwithhorse

check your saved keys using:

ssh-add -l

3. modify the ssh config

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
cd ~/.ssh/
touch config
$==> cat config
#gmail.com account
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
#racingwithhorse account
Host github.com-racingwithhorse
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_sli_racingwithhorse

4. clone you repo and modify your git config

1
2
git config user.name "racingwithhorse"
git config user.email "[email protected]"

then inside the cloned git repository

1
2
3
4
cat .git/config
[remote "origin"]
url = git@github.com-racingwithhorse:racingwithhorse/racingwithhorse.github.io.git
fetch = +refs/heads/*:refs/remotes/origin/*

That’s it!