Generate SSH Keys

We need to generate public and private SSH keys to be able to communicate between local and remote locations.


“SSH is used for remote file transfer, network management, and remote operating system access.”

If you already have SSH keys, you use them in other places. You may skip this step.

However, GitHub doesn’t accept older style keys like RSA or DSA anymore, so you need to generate an ECDSA or Ed25519 host keys, and then if your host doesn’t support these types, convert them R or DSA.

If you use PuTTY to log in to your hosting service provider, then OpenSSH doesn’t work with PuTTY, and you need to do some conversions if you have generated your keys in any other way.

1. Create a new directory in ~/.ssh or C:\Users\username\.ssh

This is where you will save and locate your SSH keys for later use. This is also where apps like GitHub Desktop and Git will look for SSH keys.

2. Open PuTTYgen, check ECDSA, click on Generate and start moving your mouse

This will generate your public and private SSH keys.

You need to add a password (passphrase) and then save four different files:

  • Two which will be used within PuTYY; to save them, click on Save public key and Save private key buttons and name them PuTTY-ecdsa.pub & PuTTY-ecdsa.ppk Respectively.
  • 2 in OpenSSH style used for GitHub and SiteGround.

The public OpenSSH key can be found on the main screen. Just copy and paste the contents into id_ecdsa.pub the file.

Then for the private key select Conversions > Export OpenSSH key (force new file format) and name it id_ecdsa

In the end, inside ~/.ssh you will have four keys that we will use in our next steps.

3. Generate RSA public and private keys from the ECDSA

Some hosting providers don’t support ECDSA type keys, and you need to generate another set of SSH keys.

  1. Open new PuTTYgen window, and click on File > Load private key
  2. Then select  PuTTY-ecdsa.ppk we saved earlier in ~/.ssh
  3. Select RSA from the options in the footer. If it is not already selected, click the Generate button and start moving your mouse.
  4. This will generate another set of keys based on the ECDSA. First, save the public OpenSSH key from the main window in ~/.ssh/id_rsa.pub
  5. Next, click on Conversions > Export OpenSSH key and save it as ~/.ssh/id_rsa