1. Manage Many Keys with SSH Config
    1. ED25519 SSH keys
    2. Manage a new SSH key pair
  2. @see

Manage Many Keys with SSH Config

ED25519 SSH keys

Following best practices, you should always favor ED25519 SSH keys, since they are more secure and have better performance over the other types. ED25519 SSH keys were introduced in OpenSSH 6.5, so any modern OS should include the option to create them.

Manage a new SSH key pair

Generate a new ED25519 SSH key pair


$ ssh-keygen -t ed25519 -C "email@example.com"

Adding an SSH key to your account

WSL / GNU/Linux (requires the xclip package)
$ xclip -sel clip < ~/.ssh/id_ed25519.pub
Git Bash on Windows
$ cat ~/.ssh/id_ed25519.pub | clip
Paste it on SSH Keys in VCS Manager

Manage config file for multiple keys

Open a terminal and use the following commands (replacing other_id_rsa with your private SSH key):

$ eval $(ssh-agent -s)
$ ssh-add ~/.ssh/other_id_rsa

To retain these settings, you'll need to save them to a configuration file. For OpenSSH clients this is configured in the ~/.ssh/config file. In this file you can set up configurations for multiple hosts, like GitLab.com, your own GitLab instance, GitHub, Bitbucket, etc.

Below are two example host configurations using their own SSH key:

# GitLab.com
Host gitlab.com
  Preferredauthentications publickey
  IdentityFile ~/.ssh/gitlab_com_rsa

Host gitlab.company.com
  HostName gitlab.company.com
  User git
  Preferredauthentications publickey
  IdentityFile ~/.ssh/id_ed25519