Setting up SSH authentication for GitHub on Windows doesn't have to be complicated. If you're working with Git repositories and want secure authentication without typing passwords constantly, SSH keys are your answer. Here's how to generate and configure them using PuTTYgen.
SSH keys provide a more secure way to authenticate with GitHub compared to traditional passwords. Once configured, they work automatically in the background—no more typing credentials every time you push or pull code. This is especially useful for developers working on multiple projects throughout the day.
First, download and install PuTTY from the official website if you don't already have it. The installation includes puttygen.exe, which is the tool we'll use to generate the SSH keys. After installation, you'll find puttygen in your Windows Start Menu.
When you launch puttygen, you'll need to select the right key type. GitHub's documentation recommends ed25519 keys as the first choice, but PuTTY doesn't support that format yet. The second recommended option is RSA with 4096 bits, which PuTTY handles perfectly. Select "RSA" from the dropdown and set the number of bits to 4096.
Click the Generate button and start moving your mouse randomly around the window. This mouse movement creates entropy that makes your key more secure. Keep moving until the progress bar fills completely.
Once generation completes, you'll see a block of text in the "Public key" field. Copy this entire block—you'll need it for GitHub in just a moment.
Log into your GitHub account and navigate to Settings. In the left sidebar, click on SSH and GPG keys. Click the green "New SSH key" button. Give your key a descriptive title like "Windows Development Machine" and paste the public key text you copied from puttygen into the key field. Click "Add SSH key" to save it.
Back in puttygen, you need to save three versions of your key for different purposes. This might seem redundant, but each format serves a specific function.
First, copy the public key text again, paste it into a text editor, and save it with a .pub extension—something like C:\MyKeys\MyKeyName.pub. This gives you an OpenSSH-format public key backup.
Second, export the private key for OpenSSH format. In puttygen, go to Conversions > Export OpenSSH key. Save this file without any extension, like C:\MyKeys\MyKeyName. Store it somewhere secure since this is your private key. The file should start with -----BEGIN OPENSSH PRIVATE KEY----- and contain a long string of encoded data.
Third, save the private key in PuTTY's native format. Click "Save private key" and save it with a .ppk extension, like C:\MyKeys\MyKeyName.ppk. This format is what PuTTY's authentication agent will use.
Pageant is PuTTY's SSH authentication agent—it runs in the background and handles your SSH keys automatically. If PuTTY installed correctly, Pageant should already be running in your system tray (look for a small computer icon wearing a hat).
Double-click the Pageant icon to open it, then click "Add Key" and select your .ppk file. Once added, you'll see your key listed with its comment and key type. Pageant will now automatically provide this key whenever you connect to GitHub via SSH.
If you want Pageant to load your key automatically at startup, you can add the .ppk file to your Windows startup folder or create a shortcut that launches Pageant with your key file as a parameter.
Open a command prompt or PowerShell window and type ssh -T git@github.com. If everything is configured correctly, you should see a message saying "Hi username! You've successfully authenticated." The connection might fail the first time and ask you to verify GitHub's fingerprint—type "yes" to continue.
From this point forward, any Git operations using SSH URLs will authenticate automatically through Pageant. You can clone repositories using SSH format (git@github.com:username/repo.git), and push and pull without entering credentials.
If authentication fails, check a few common issues. Make sure Pageant is actually running and your key is loaded—you should see it listed when you open Pageant. Verify that you copied the entire public key to GitHub without any extra spaces or line breaks. And confirm you're using SSH URLs for your repositories, not HTTPS URLs.
If you need to start over, you can always re-import your OpenSSH private key back into puttygen. This is why we saved multiple formats—it gives you fallback options if something gets corrupted or lost.
The initial setup takes a few minutes, but once configured, SSH authentication makes your GitHub workflow significantly smoother. No more password prompts, no more credential managers—just seamless, secure access to your repositories.