Skip to content

Instantly share code, notes, and snippets.

@mtvbrianking
Created March 19, 2022 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtvbrianking/9bf141cb0bdbb04cc868d7b31da2d74b to your computer and use it in GitHub Desktop.
Save mtvbrianking/9bf141cb0bdbb04cc868d7b31da2d74b to your computer and use it in GitHub Desktop.
Multile SSH Setup

Generate ssh key pair

ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa_github -C "127.0.0.1"
ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa_gitlab -C "127.0.0.1"

Upload the *.pub to Github / Gitlab respectively.

Map ssh keys

vi ~/.ssh/config

Host github
    HostName github.com
    User git
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa_github

Host gitlab
    HostName gitlab.com
    User git
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa_gitlab

Test connectivity

ssh -T git@github.com
ssh -T git@gitlab.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment