Pre
generate id_rsa
file
ssh-keygen -t rsa -C "xxx1@xx.com"
ssh-keygen -t rsa -C "xxx2@xx.com"
ssh-keygen -t rsa -C "xxx2@xx.com"
|
Step1: Switch to ~/.ssh path
Step2: Create config file
$ touch config $ vim config
|
Host first.github.com HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/github_id_rsa
Host second.github.com HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/github_id_rsa
Host gitlab.com HostName gitlab.com PreferredAuthentications publickey IdentityFile ~/.ssh/gitlab_id_rsa
|
How to Use
Use git clone
as example:
git clone git@first.github.com:xxx.git git clone git@second.github.com:xxx.git
|
Author:
NatalieXSelina
Permalink:
https://nataliexselina.github.io/Set-up-Multiple-SSH-keys/
License:
Copyright (c) 2019 CC-BY-NC-4.0 LICENSE