How to Upload Cloud9 Ssh Key to Repository Provider
How To Add Multiple SSH Keys
Hello Everyone
Welcome to CloudAffaire and this is Debjeet.
With the increase use of git-based version command systems similar GitHub or GitLab, its quite evident that y'all may require multiple ssh keys to maintain dissimilar git repository for different accounts. In this blog post, we will discuss how to add multiple SSH keys in Windows or Linux system for multiple GitHub business relationship.
The example given in this blog is with GitHub, but the aforementioned arroyo (with some minute changes) tin can be used for other providers like GitLab or Bitbucket etc.
Prerequisite:
- Multiple GitHub business relationship
- Git installed in your local system
How To Add Multiple SSH Keys In Windows:
Stride 1: Generate SSH keys for target systems
For this demo we volition generate three keys, 2 for GitHub (for two split up business relationship) and 1 for GitLab. This volition give cover multiple providers, multiple account scenarios.
| # Generate key for GitHub - Account A (<a href="mailto:cloudaffaire@gmail.com">cloudaffaire@gmail.com</a>) ssh - keygen - t ed25519 - C "cloudaffaire@gmail.com" - f $Home / .ssh / cloudaffaire_github - q - Due north "" "" # Generate key for GitHub – Account B (<a href="mailto:debjeettoni@gmail.com">debjeettoni@gmail.com</a>) ssh - keygen - t ed25519 - C "debjeettoni@gmail.com" - f $Home / .ssh / debjeet_github - q - Due north "" "" # Generate key for GitLab - Account A (<a href="mailto:cloudaffaire@gmail.com">cloudaffaire@gmail.com</a>) ssh - keygen - t ed25519 - C "cloudaffaire@gmail.com" - f $Habitation / .ssh / cloudaffaire_gitlab - q - Due north "" "" # You should have three key pairs now dir $abode / .ssh |
Note: It'southward recommended to apply key-phrase during ssh key generation.
Step two: Add together the public keys (.pub extension) to respective GitHub and GitLab accounts.
Login to GitHub with account A credentials and setup SSH keys.
Copy the content of $Home/.ssh/cloudaffaire_github.pub file and paste in the Cardinal section below.
Provide your GitHub password if prompted.
Next, login to GitHub over again with Account B credentials and repeat the same stride to add together the fundamental.
Notation: This time you accept to copy the content of $Domicile/.ssh/debjeet_github.pub
Finally add the key for your GitLab business relationship as well. Yous can follow step ii and iii beneath weblog for same.
https://cloudaffaire.com/how-to-add-an-ssh-key-in-your-gitlab-profile/
Step 3: Create a ssh config file
| ane ii 3 4 5 6 7 8 9 x 11 12 13 14 15 16 17 18 19 20 21 | $config = @' # Account- github - cloudaffaire Host github .com HostName github .com User cloudaffaire @ gmail .com IdentityFile ~ / .ssh / cloudaffaire_github # Account- github - debjeet Host github .com HostName github .com User debjeettoni @ gmail .com IdentityFile ~ / .ssh / debjeet_github # Business relationship- github - cloudaffaire Host gitlab .com HostName gitlab .com User cloudaffaire @ gmail .com IdentityFile ~ / .ssh / cloudaffaire _gitlab '@ repeat $config | Add - Content - Path $Habitation / .ssh / config |
Step 4: Add SSH private keys into the SSH authentication agent
| # starting time ssh agent Go - Service - Name ssh - amanuensis | Set - Service - StartupType Automated Start - Service ssh - agent # add private keys into ssh authentication amanuensis ssh - add $Habitation / .ssh / cloudaffaire_github ssh - add $Home / .ssh / debjeet_github ssh - add $Abode / .ssh / cloudaffaire_gitlab |
Step 5: Finally, we reach the bespeak to test if everything works
| git clone git @ github .com : debjeettoni / gitTest .git Remove - Item 'gitTest' - Recurse - Force git clone git @ github .com : CloudAffaire / gitTest .git Remove - Item 'gitTest' - Recurse - Strength git clone git @ gitlab .com : cloudaffaire / gittest .git Remove - Detail 'gitTest' - Recurse - Force |
Note: You might become a warning as beneath, type yep
RSA key fingerprint is SHA256:ngfsdfsfd723hvhsdvbksghTxdCARLviKw6E5SY8.
This key is not known by whatever other names
Are you certain you desire to keep connecting (yep/no/[fingerprint])? yes
How To Add Multiple SSH Keys In Linux:
Footstep 1: Aforementioned as step 1 for Windows.
Step 2: Same equally step ii for Windows.
Step 3: Create a ssh config file
| 1 two 3 4 5 half dozen 7 8 9 ten 11 12 xiii 14 15 16 17 18 xix | true cat << EOT >> ~ / .ssh / config # Business relationship- github - cloudaffaire Host github .com HostName github .com User cloudaffaire @ gmail .com IdentityFile ~ / .ssh / cloudaffaire_github # Account- github - debjeet Host github .com HostName github .com User debjeettoni @ gmail .com IdentityFile ~ / .ssh / debjeet_github # Business relationship- github - cloudaffaire Host gitlab .com HostName gitlab .com User cloudaffaire @ gmail .com IdentityFile ~ / .ssh / cloudaffaire_gitlab EOT |
Step 4: Add SSH individual keys into the SSH hallmark agent
| # start ssh agent eval ` ssh - agent - s ` # add private keys into ssh authentication agent ssh - add ~ / .ssh / cloudaffaire_github ssh - add ~ / .ssh / debjeet_github ssh - add ~ / .ssh / cloudaffaire_gitlab |
Step 5: Finally, we reach the point to test if everything works
| git clone git @ github .com : debjeettoni / gitTest .git rm - r gitTest git clone git @ github .com : CloudAffaire / gitTest .git rm - r gitTest git clone git @ gitlab .com : cloudaffaire / gittest .git rm - r gittest |
Note: You might get a warning as below, type yes
RSA key fingerprint is SHA256:nThbshdfy674vshdvjhsbdjgllasddsKw6E5SY8.
This primal is not known past any other names
Are yous certain you want to proceed connecting (yeah/no/[fingerprint])? yep
Hope you have enjoyed this commodity.
pollarddishemeard.blogspot.com
Source: https://cloudaffaire.com/how-to-add-multiple-ssh-keys/
0 Response to "How to Upload Cloud9 Ssh Key to Repository Provider"
Post a Comment