Before you generate a pair of SSH keys, make sure you do not have one already. Open a terminal and enter:
If you see two files named id_rsa and id_rsa.pub, you already have SSH keys and may ignore this step. The files may also be called id_dsa and id_dsa.pub, depending on the encryption algorithm used. To generate a pair of keys, use the following command:
ssh-keygen -b 4096 -t rsa
You will be asked: where you want to register the keys (the default value is recommended) and for a passphrase. This passphrase is not mandatory but recommended, because it adds an extra security layer for if and when someone tries to access your computer. You now have two keys: - ~/.ssh/id_rsa is your private key - ~/.ssh/id_rsa.pub is the public key that will be on remote servers
In Windows, you can generate SSH keys with the PuTTYgen application Download then install it. Click Generate then move your mouse to the window to generate the code to use to obtain a totally random key.
Once your SSH key has been generated, copy the public key into a file. Save the private key to your computer; you will need it to connect to your servers.