Development Git ssh

SSH Key Setup for GitHub

To understand Github you first need to make sure you are aware of a Git . Git is a open source version control system that was started by Linus Trovalds. In short Git is a version control system like Subversion and CVS. You will be able to use this by installing “git” command and utilities in your server. Git is a command-line tool, and GitHub is the place where developers store their projects and works and will be able to share with the rest of the world and can give them version upgrades as well. You have options to create private and public repositories and can use them as per your needs.

To start with you need to make sure you have a linux terminal with git command installed and have ability of using git command by the user at which you are trying. Always try to use a separate user and do not use root user for the same. Also you need to create a account with Github.

Create an Account with Github

To create a account with Github, you can follow the below steps

  • Go to “Join GitHub”
  • Fill in your information and click “Create an account”
  • Select the plan you want and click “Finish sign up”
  • When you sign up, you’ll receive an email to verify your email address.  Click the link to complete verification.

Once account is created next step is to create a fresh key pair and then add them to Github.

Adding Your SSH Key to Your GitHub Account

Login to your terminal via SSH.

Generate a key pair by running the following command, substituting in your GitHub email address between the quotes:

# ssh-keygen -t rsa -b 4096 -C “”

When you’re prompted to “Enter a file in which to save the key,” press Enter to save it in the default location. If you wish to use a different location, you can provide the path to be used here as well.

At the prompt, type a secure passphrase that will be used when your key is authenticating, and confirm it. You can even do not setup this passphrase if you don’t need extra verification. So now you have generated the SSH key pair. Make sure you make a note on things like public key and private key files.

To add ssh key in the GitHub you need to take a copy of the public key and you can use the below ssh command to get this done.

# cat /home/user/.ssh/

Once you have copied the content in your clipboard or in any local text file, we can use the below steps to add the key to Github account.

  • You need to login to Github Account using your user/pass
  • Click on the Profile pic and select “Settings” from the Drop down.
  • Select “SSH and GPG Keys” from the Menu in the left hand side

To add your first key or another key click on “New SSH key”

In the “Title” field, you need to add a label which you can remember.  (I used  “Sumesh’s MacBook Air”).

You can use any word and only thing you need to take care is you need to make sure that will help you to identify the machine on which that key is generated.

In “key” Field add the above key which you get by using the command “cat /home/user/.ssh/” which will start with ssh-rsa

  • Click Add SSH key.

If prompted, confirm your GitHub password which will be used for verification.

Now you can see the key listed which you have added in the title name. And you will need to do the same procedure for each computer , live servers dev/staging servers which needs to access your repositories.

Check your Connection from local machine to Github

Open a new ssh terminal and make sure you switch to the user for which you had created the ssh key pair. To connect with Github account via ssh key, you need to type the below and press enter

# ssh -T

If you connecting this for the first time from that machine, you will see a result like the below and you need to type Yes in this case:

The authenticity of host ' (' can't be established.
RSA key fingerprint is SHA256:asdnasd871321312kjaksjdasdijsaidjsad1Rk3ndm.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ',' (RSA) to the list of known hosts.
  • Type “yes”
  • Press Enter

You will see output like this:

“Hi user ! You've successfully authenticated, but GitHub does not provide shell access.”

If the above mentioned user is correct and is displayed as the same one which you tried adding, then all is fine and you have completed the ssh key setup with Github ! If you are getting permission denied, then we need to cross check the above steps and make sure you have done everything as per the above doc.  You can always contact me if you need any help in this case.

About the author


Sumesh Prabhu

I am Linux Server Administrator by Profession for the last 9 years and works mainly as a freelancer in Fiver and have a small hosting company mainly for my personal clients which I have acquired over the last many years . My personal site where I have started a Forum and Blog to discuss server related issues as well.
Site :
Blog :
Forum :
Linux Hosting :