A step-by-step instruction to generate ssh on linux
- Open your respective virtual machine with Linux OS inside. (eg. LinuxLite, Kali)
- After booting up the virtual machines, Open Terminal
- Before we generate SSH key, open firefox or web browser on your linux and login your Github account. If you don't have an account yet, Register Github here.
- When you are logged in, Go to settings by clicking on your profile picture dropdown in the top-right most of the website. Then click Settings and scroll down and click the SSH and GPG keys. Or, click here SSH and GPG settings
- Then, let's go back to our terminal and let's install git first using this command
sudo apt install git- After installing git, then let's generate our ssh key. To generate, type this command
ssh-keygen -t ed25519 -C "your_email@example.com"Example:
ssh-keygen -t ed25519 -C "chase_umak@gmail.com"Make sure that your e-mail address is the same on the e-mail address you provide on your github account
-
And make a passphrase on your ssh key and press enter and you will see like this

-
When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location
> Enter a file in which to save the key (/home/you/.ssh/id_ed25519): [Press enter]In this case our ssh key file name is id_ed25519 and id_ed25519.pub.
- The default location of your ssh keys is at .ssh folder which is not visible if you type the
console lscommand.
- ALright, let's go to the .ssh folder to view the name of our key. type
cd .ssh
lsAnd this will show the files on our .ssh folder including our ssh key files and you will see the .pub file. (eg. id_ed25519.pub)
- Let's view the contents of our ssh .pub (id_ed25519.pub) by typing this command
cat id_ed25519.pubAnd it will show something like this

And copy that key using Ctrl+Shift+C or Right click and copy.
-
After copying the key, let's go back to our github and click "New SSH" button and you will be redirect to Add New SSH Keys page and enter your ssh key title on the Title input box and paste your copied SSH key to Key text area and click Add SSH key.

-
After that, let's test if our key is successfully connected to our github account by going back to our Terminal and typing this command:
ssh -T git@github.comAfter that, you will see a confirmation like this.

- Great, we are now successfully generated SSH keys and connect it to Github.
Generate new SSH key Add new SSH Key Test your SSH keys
Prepared by: Christopher Robin Chase