Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

set muiltiple ssh keys for different github accounts on one computer

# navigating to the ssh directory, run the following command.
cd .ssh/

# Generate SSH key for each GitHub account
ssh-keygen -t rsa -C "your_name@email.com"
id_rsa_personal
ssh-keygen -t rsa -C "your_name@organization_email.com"
id_rsa_work
ls ~/.ssh
cat id_rsa_personal.pub
Copy the SSH key and then sign in to your GitHub account.

Follow the steps below to add an SSH key to your GitHub account:

On your GitHub, navigate to Settings.
Choose SSH and GPG keys - Gnu Privacy Guard (GPG) is an encryption technique that allows secure information sharing among parties.
Hit on the New SSH Key button, give it a significant Title and paste the Key.
Finally, click the Add SSH key button.
open your git config fle if it exists
~/.ssh/config
If it exists, you can edit it, or else it can be created using this command:

touch config
nano config
in nano config
# Personal account, - the default config
Host github.com-"type your personal github username"
   HostName github.com
   User git
   IdentityFile ~/.ssh/id_rsa_personal
   
# Work account
Host github.com-"type your organization github username"  
   HostName github.com
   User git
   IdentityFile ~/.ssh/id_rsa_work
   
  hit Ctrl X to save and close nano
  Done!!
Source by www.section.io #
 
PREVIOUS NEXT
Tagged: #set #muiltiple #ssh #keys #github #accounts #computer
ADD COMMENT
Topic
Name
4+1 =