Skip to content

Instantly share code, notes, and snippets.

@1um
Last active August 21, 2018 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save 1um/0b8c32a6c189527c10b5 to your computer and use it in GitHub Desktop.
Save 1um/0b8c32a6c189527c10b5 to your computer and use it in GitHub Desktop.
Enable two keys for GitHub and GitLab
  1. generate new identifity:

    $ ssh-keygen -t rsa -C "your_email@youremail.com" #save in ~/.ssh/id_rsa2 $ ssh-add ~/.ssh/id_rsa2

  2. add id_rsa2.pub on github and id_rsa.pub(old one) to gitlub

  3. create config for ssh

    $ nano ~/.ssh/config

    Host * ForwardAgent yes #another Host github.com HostName github.com User razum.reg@gmail.com IdentityFile ~/.ssh/id_rsa2 #repetitor Host gitlab.sakema.net HostName gitlab.sakema.net User onum.mail@gmail.com IdentityFile ~/.ssh/id_rsa

  4. check:

    $ ssh -T git@github.com
    Hi 1um! You've successfully authenticated, but GitHub does not provide shell access.

    $ ssh -T git@gitlab.sakema.net Welcome to GitLab, Pavel Razumovskiy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment