Swipe left or right to navigate to next or previous post
This blog post is about how to generate SSH Keys for different GitHub accounts and use those keys to access different GitHub accounts. The blog is based on the GitHub and Ubuntu Server. However, the concept to create the SSH keys and updating on the source code management system is same.
SSH (Secure Shell) is secure cryptographic network protocol to connect with a server. The SSH protocol is mainly used to access the remote servers.
SSH is based on the client server model which perform secure communication between computers with encryption and verification to access, configure the remote server and transmit the files to and from the remote server.
For the tutorial purpose, we are considering we have two emails, one for personal use and another for office use. We will use [email protected] as personal email address and [email protected] as business uses or office uses.
We suggest creating the ssh keys inside the .ssh folder. If folder is not available, create using the following command
mkdir .ssh cd .ssh
ssh-keygen -t rsa -C "[email protected]"
This commands will generate something like below
The prompt will ask for the unique name. Enter the unique name that best describe the purpose or type of that email. For the tutorial purpose, we will go with the id_rsa_personal.
It will generate two files inside .ssh folder.
Use the following command to generate the SSH key for the email
ssh-keygen -t rsa -C "[email protected]"
It will generate something like below
The prompt will ask for the unique name. Enter the unique name that best describe the purpose or type of that email. For the tutorial purpose, we will go with the id_rsa_office.
It will generate two files inside .ssh folder.
First you need to grab the details on the public file
cat id_rsa_personal.pub
You will be able to clone, commit the changes to the repo that belongs to [email protected] Github Account
The steps to grab and set the public key in GitHub account is same as personal email address. Once the public key is updated on the GitHub, one will be able to clone to the repo, push changes to the repo.