We can connect to GitHub servers using SSH keys. Using the SSH, you can connect and authenticate to remote GitHub in a secure way. With SSH keys, you can connect to GitHub without supplying your username/password every time you interact. The picture below shows the ssh communication between client and server using Putty.
Generate SSH key
If you do not have any existing keys you can generate one using the OpenSSH command. On Windows 10 platform, you can find the ssh keys under the below folder:
Once you’ve checked for existing SSH keys, if none exists, you can generate a new SSH key.
ssh-keygen -t rsa -b 4096 -C “<username_at_github>”
Note: remove the placeholders < and > in the original command that you issue.
When you’re prompted to “Enter a file in which to save the key,” press Enter.
At the prompt, type your secure passphrase and confirm it.
Adding the key to GitHub account
To configure your GitHub account to use your new or existing SSH key, you’ll need to add it to your GitHub account as shown in the below screen.
Go to your Profile Settings >> SSH and GPG keys
Click on the New SSH key button to add.
Enter the title and the key and click on Add SSH key button. The key usually starts with ssh-rsa since we have used RSA Encryption algorithm.
That’s it. You are done with adding the key to your GitHub account. You can test the communication by launching Git Bash and perform some action like pushing some stuff to your repository.