-3

I have different users for different github organizations, each with their own ssh keys. How can I easily switch between ssh keys for different accounts?

1

1 Answer 1

2

Its quite possible with a little configuration in the ~/.ssh/config file.

The trick is - the Host in the .ssh config does not have to be the real Hostname

# add the ~/.ssh/id_altUsername file for the new user on Github
# ssh -T git@github-altUsername # test it can connect
# git clone git@github-altUsername:alt_username/[repo].git

Host github-altUsername
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_altUsername
    IdentitiesOnly yes
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.