0

I created a Keypair for Github, and now I'm trying to create another Keypair for Gitlab following this guide https://docs.gitlab.com/ee/user/ssh.html.

But how will I be able to differentiate both and know which Keypair belongs to which? Will putting different comments help me?

ssh-keygen -t ed25519-sk -C "<comment>"
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
tadm123
  • 8,294
  • 7
  • 28
  • 44
  • Does this answer your question? [How to specify the private SSH-key to use when executing shell command on Git?](https://stackoverflow.com/questions/4565700/how-to-specify-the-private-ssh-key-to-use-when-executing-shell-command-on-git) – Arty-chan Oct 16 '22 at 05:29

1 Answers1

0

You can reference them in a ~/.ssh/config file:

Host ghUser1
  Hostname github.com
  User git
  IdentityFile ~/.ssh/key1

Host ghUser2
  Hostname github.com
  User git
  IdentityFile ~/.ssh/key2

Replace User1 by your actual GitHub Username for instance.

You can then test the associated GitHub identity with:

ssh -T ghUser1
ssh -T ghUser2

And clone a repository with git clone ghUser1:User1/aRepository

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250