Adding additional ssh-keys to your .ssh

Usually people will just create one key with just default command 


get a public/private pair in (/Users/my_user/.ssh/id_rsa) and use that for anything, but there is much more to this then that. You can create many keys and use them for separate accounts and also automate that.

For example

ssh-keygen -f ~/.ssh/<username>  -C ""

this will generate key with specific username and email you want and save it as such. Then you can add this info to config in ~/.ssh/config
and use it from there to connect which ssh key to use with which host like

Host github-org
    User git
    IdentityFile ~/.ssh/

so you can have a key for each of the accounts/hosts you are using for some additional security and separation.
For some more info on that look here…

Before finishing all, you need to add this new key to SSH agent, you do that with

ssh-add -K ~/.ssh/new_key

On mac OSx if you reset your computer, you will need to add it again. Other wise you will get
Permission denied (publickey) error. To have that autoloaded update your ~/.ssh/config to this

Host github-org
    User git
    AddKeysToAgent yes
    UseKeychain yes
    IdentityFile ~/.ssh/

As stated here…

If you're using macOS Sierra 10.12.2 or later, you will need to modify your ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain.



Some tips on using multiple keys and how to make it work in easy way…