Macbook setup multiple ssh accounts for github
You can connect to GitHub using the Secure Shell Protocol (SSH), which provides a secure channel over an unsecured network. Setting up one github account is fairly easy, with multiple accounts setup using different ssh keys gets bit complicated.
Table of Contents
I have two Github accounts: hshanbhag (personal) and hshanbhag9 (for work). I want to use both accounts on the same computer. Github doesn’t allow to use same ssh public key for both accounts.
Use ssh keys and define host aliases in ssh config file (each alias for an account).
Edit/Create ssh config file (
# Default github account: hshanbhag
# Other github account: hshanbhag
Test your connection
With each command, you may see this kind of warning, type
The authenticity of host 'github.com' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:
Are you sure you want to continue connecting (yes/no)?
If everything is OK, you will see these messages:
Hi hshanbhag9! You've successfully authenticated, but GitHub does not provide shell access.
Hi hshanbhag! You've successfully authenticated, but GitHub does not provide shell access.
Now all are set, just clone your repositories. Then add the name and email address which you want to use for respective repo.