How to generate a SSH key

Whenever I need to connect to GitHub a web server I would generate an SSH key so that it can be used to authenticate myself whenever I connect to GitHub or web servers.

Generating the key

Open the terminal and go to the .ssh folder, if it doesn’t exist create it.

cd ~/.ssh

Use the ssh-keygen command.

ssh-keygen

You will receive a prompt to either enter a name for the key or use the default name(id_ed25519).

Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/mesh/.ssh/id_ed25519): test-key

You can either add a passphrase for extra security or leave it blank.

Enter passphrase (empty for no passphrase):

Enter the passphrase again to confirm.

Enter same passphrase again:

When you check the current directory you can see the private and public keys.

-rw------- 1 mesh mesh  411 May  2 21:15 test-key
-rw-r--r-- 1 mesh mesh   99 May  2 21:15 test-key.pub