{"@id":"cedric-dumont.com"}

A developer's braindump

Using multiple accounts on the same machine for github

First create your two ssh keys and add them to the ssh agent

ssh-keygen -t rsa -C "x@outlook.com"

save it to idrsax

ssh-keygen -t rsa -C "y@outlook.com"

save it to idrsay

check if agent is running eval "$(ssh-agent -s)"

add the Identity to the agent (will ask for passphrase)

ssh-add -K ~/.ssh/idrsax

ssh-add -K ~/.ssh/idrsay

create a config file in the .ssh folder

# x account
Host x
HostName github.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa_x

# y account
Host y
HostName github.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa_y

now, if you clone for x, use

git clone git@x:CedricDumont/Trade.git

instead of

git clone git@github.com:CedricDumont/Trade.git

see : use x instead of github.com in the git ssh url

Prev: /2018/05/03/how-to-get-the-running-port-in-springboot-tests/