DEV Community

Cover image for How to setup your Github SSH-Keys in 3 easy steps
Mokhele Katleho
Mokhele Katleho

Posted on

How to setup your Github SSH-Keys in 3 easy steps

Are you tired of having to repeatedly input your username and password everytime when you try to access github?or maybe you just want a more secure and convenient way to be authenticated when accessing your github? If your answer is yes then Secure Shell Keys(SSH-Keys) are a solution to this problem. In this blog I will be guiding you through the process of setting up SSH Keys on github

Step 1 : Check for existing SSH Keys
Before you generate your SSH key, you should start by checking if you don't already have an existing key; You can do this by running the following command on your terminal:

ls -al ~/.ssh
Enter fullscreen mode Exit fullscreen mode

If you have any existing SSH keys this command will list them,if you don't have any existing SSH keys don't worry, just follow along.

Step 2 : Generate a New SSH Key
If you don't have an existing SSH key, you can easily generate one by running the following command:

ssh-keygen -t rsa -b 4096 -C "your email"
Enter fullscreen mode Exit fullscreen mode

After running this command you will be prompted to enter the file name and the passphrase for the new SSH key, you can just click enter to use the default filename(id_rsa) and the passphrase is optional if you want some extra security.

Step 3 : Add the SSH Key to your github account
After your SSH key has been successfully generated, you will now have to add it to your github account. Login to your github account and go to your account settings, then click on the "SSH and GPG Keys" tab; see screenshot below.

setting up Github SSH keys
After that now click the "Add new SSH key" button and give your new SSH key a title, the title can be anything you like. Next copy the key from the "id_rsa.pub" file located in your "~/.ssh" folder and paste it into the "Key" field. The ssh folder was created when you generated your new SSH key and this is where your key is stored. Please note that the 'ssh' folder might be hidden by default,if this is the case for you just simply click on the "show hidden files" checkbox under the views tab on your taskbar:
setting up Github SSH keys
Now finally, if you successfully copied your SSH Key to your github, click the "Add SSH key" button

Conclusion
SSH keys provide a secure and convenient way to authenticate your access when using github. By following the steps from this article, you will be able to easily setup your SSH keys.

Top comments (0)