Page 1 of 1

Generating a GitHub ssh key using puttygen in Windows

Posted: Thu Oct 12, 2023 8:44 am
by AndrewP
Not really a 6502 specific topic but I wanted to document this somewhere as doing development on Windows using GitHub can be a bit of a fraught process initially.

Download and install Putty (if you don't have it already). This will install puttygen.exe

Run puttygen, it should be available from the Windows Start Menu after installation.

GitHub recommend using an ed25519 type key but Putty doesn't seem to support that. Secondarily they recommend an RSA 4096 type key and that can be generated by Putty.
PuttyGen-RSA-4096.png
Click Generate
PuttyGen-Generate.png
and wave your mouse around until the green bar is satisfied.

Once the key is generated copy the Public-key text...
PuttyGen-Copy-public-key.png
...into a new GitHub SSH Key. This can be found under your Account Settings, SSH and GPG keys:
Github-New-ssh-key.png
And paste the Public-Key text into your new GitHub SSH Key
Github-Paste-key.png
Add SSH Key and we're done on the GitHub side of things.

Back in puttygen copy the Public-Key text again, paste it into a text editor and save it somewhere useful with the .pub extension. E.g. C:\MyKeys\MyKeyName.pub Do not use the Save Public Key button from puttygen unless you know what you're doing. We're saving the OpenSSH Public-Key text just-in-case.

Next export the Private-Key for OpenSSH, again this is just-in-case...
PuttyGen-Export-private-key.png
...and save it somewhere secure. E.g. C:\MyKeys\MyKeyName Note the lack of extension.

The saved Private-Key should look something like this:

Code: Select all

-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAA
...
BAUGBwgJ
-----END OPENSSH PRIVATE KEY-----
...but with a lot more gumph in it. If things go terribly wrong the OpenSSH private key can always be re-imported back into puttygen.

Finally we need to Save the Private-Key in a form that can be used by Putty's authentication agent Pageant.
PuttyGen-Save-private-key.png
Save it somewhere secure E.g. C:\MyKeys\MyKeyName.ppk and note the ppk extension.

The PPK should look something like:

Code: Select all

PuTTY-User-Key-File-3: ssh-rsa
Encryption: none
Comment: rsa-key-20231012
Public-Lines: 12
AAAAB3NzaC1yc2EAAAADAQABAAACAQDpDTEMZZf9WIFtlGdlIMJDskcHpvP1
...
WnUQlA==
Private-MAC: bbac19a0c60363e1ced7f7c72c340709991381d4706e3e6ee345e1cc24540850
Finally open Pageant from the task bar by double clicking its icon (it should have started running when Putty was installed).
Pageant-Taskbar.png
Pageant-Taskbar.png (14.92 KiB) Viewed 31405 times
And add your newly saved PPK.
Pageant-Add-key.png
If everything has gone correctly you should see your new PPK in Pageant:
Pageant-done.png
And you can now talk to GitHub using Putty via SSH!

Re: Generating a GitHub ssh key using puttygen in Windows

Posted: Wed Feb 04, 2026 11:32 am
by lars
According to https://www.chiark.greenend.org.uk/~sgt ... anges.html, the ed25519 key type is supported in puttygen since PuTTY 0.68, released 2017-02-21

Re: Generating a GitHub ssh key using puttygen in Windows

Posted: Wed Feb 04, 2026 11:49 am
by lars
Heavily recommended: Use a long password on the SSH key so if someone obtains your key without permission, you do not lose your kingdom

Re: Generating a GitHub ssh key using puttygen in Windows

Posted: Wed Feb 04, 2026 12:56 pm
by AndrewP
lars wrote:
According to https://www.chiark.greenend.org.uk/~sgt ... anges.html, the ed25519 key type is supported in puttygen since PuTTY 0.68, released 2017-02-21
Thanks for pointing that out.

Following the Windows 11 debacle I've since moved to Linux and so am no longer using Putty but still useful to know.

Re: Generating a GitHub ssh key using puttygen in Windows

Posted: Thu Feb 05, 2026 5:49 pm
by jgharston
Wow, it wasn't this complicated when I last used GitHub. I just clicked on the appropriate buttons. But they have increasingly borked it, I keep having to write down how to find things, and they keep moving around, or vanish, or just plain don't respond.

I've got some recent updates to upload, I'll see what happens.

Re: Generating a GitHub ssh key using puttygen in Windows

Posted: Thu Feb 05, 2026 8:39 pm
by Yuri
I should note that puTTY is not the most intuitive thing to use when it comes to key management. They have their own key store/format for managing keys, which requires extra hoops to get them into the correct format for Github (or just about anything else; a thing I fight with often when I have to update the keys across the 30+ Linux boxes I have to deal with at work.)


The Windows Git Command Prompt package includes OpenSSL though, so you can still run the ssh-keygen and openssl commands from there and get the needed formats.

See here for details:
https://www.geeksforgeeks.org/git/how-t ... b-account/