DEV Community

Tek Kshetri
Tek Kshetri

Posted on

Generate and Add a new SSH key to your GitHub account

When working with a GitHub repository, you'll often need to identify yourself to GitHub using your username and password. An SSH key is an alternate way to identify yourself that doesn't require you to enter you username and password every time. To add such key, you need to generate it on your PC. To generate and add it to GitHub, you need to follow following steps,

1. Generate the SSH key

The SSH key can be generated using ssh-keygen command using git bash as below,

ssh-keygen -t ed25519 -C ""
Enter fullscreen mode Exit fullscreen mode

replace with your actual email address.

2. Add your SSH key to GitHub

By default, the SSH key will be stored in the home directory. Now, you need to copy the public key. The public key can be seen using cat command as below,

cat ~/.ssh/
Enter fullscreen mode Exit fullscreen mode

Copy the public key from terminal. The final step is to add it to the GitHub.

SSH key add to github

To add it, go to your GitHub profile settings > SSH and GPG keys > new SSH key, add title for your key and paste the public key in Key box.

I hope this post is informative for you. If you like this blog, please support me by subscribing to my YouTube channel:

Top comments (0)