#For example, for ED25519:
> ssh-keygen -t ed25519 -C "<comment>"
#For 2048-bit RSA:
> ssh-keygen -t rsa -b 2048 -C "<comment>"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/user/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
> eval $(ssh-agent -s)
> ssh-add <directory to private SSH key>
Ssh config
# GitLab.com
Host gitlab.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitlab_com_rsa
# Private GitLab instance
Host gitlab.company.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/example_com_rsa