For increased security or any other reason, you can have different SSH keys configured for different hosts.
ssh-keygen -t rsa -b 4096 -C "firstname.lastname@example.org" -f ~/.ssh/id_rsa_personal ssh-keygen -t rsa -b 4096 -C "email@example.com" -f ~/.ssh/id_rsa_work
Tip: On Windows, ssh configuration and keys are stored in
Edit (or create) a file named
~/.ssh/config and see example configuration below:
Host gitlab.com HostName gitlab.com IdentityFile ~/.ssh/id_rsa_personal Host github.com HostName github.com IdentityFile ~/.ssh/id_rsa_personal Host bitbucket.org HostName bitbucket.org IdentityFile ~/.ssh/id_rsa_work Host vs-ssh.visualstudio.com HostName vs-ssh.visualstudio.com IdentityFile ~/.ssh/id_rsa_work
It’s also possible to configure multiple ssh keys for a single host using aliases.