I will be going to show you how to create a SSH key for git so that you don’t need to type your password again and again while pushing your local code.
To check existing SSH keys in your machine run the following commands in the terminal:
cd ~/.ssh/ ls -a
This will list all your keys in the ‘~/.ssh’ folder.
To create a new ssh key you need to run:
ssh-keygen -t rsa -C "firstname.lastname@example.org" Generating public/private rsa key pair. Enter file in which to save the key (/home/JacksonIsaac/.ssh/id_rsa):
Here, your email-id will be used as a label for the SSH key.
You can simply press Enter and the SSH key will be saved as ‘~/.ssh/id_rsa’. You can also select a custom filename as per your wish.
Now you need to enter your passphrase (keep empty for no passphrase)
Enter passphrase (empty for no passphrase): Enter same passphrase again:
The SSH key will be generated and you will get your key fingerprint.
Your identification has been saved in /home/jacksonisaac/.ssh/id_rsa. # Your public key has been saved in /home/jacksonisaac/.ssh/id_rsa.pub. Your key fingerprint is: 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db email@example.com
Add your ssh key to ssh-agent
Copy your public key and paste it in the SSH Key box at ‘https://github.com/settings/ssh‘
You can view your public key by using cat (which displays the contect on the terminal itself) or use gedit to open the file and you can copy-paste the key.
Note: Remember to copy the public key (file ending with .pub) and not the private key.
You can also copy the public key using terminal clipboard tools like xclip and many more.
Let the Windows be open, and feel the Freedom.