Setting Up SSH for GitHub on Windows

Tips, Git 

Wednesday, March 11th, 2026

Setting Up SSH for GitHub on WindowsA no-nonsense guide for people who keep forgetting this

In the spirit of me always forgetting how to add SSH, I am writing this post for me and any other person with a short-term memory. This guide is short, direct, and includes the exact commands you need, nothing more.

Step 1 - Check for existing SSH keys

Before generating a new key, check if you already have one. Open Git Bash or CMD and run:

If you see id_ed25519 and id_ed25519.pub already listed, skip straight to Step 3.

Step 2 - Generate a new SSH key

Replace the email with your GitHub email:

Hit Enter to accept the default file path. When asked for a passphrase, you can set one or skip it by pressing Enter.

⚠️ If you set a passphrase, you will need to enter it once per Windows session (after reboot). On a personal PC, skipping it is fine.

The ed25519 part is the cryptographic algorithm, a modern, fast, and secure method for generating key pairs. It's the recommended default over the older RSA.

Step 3 - Start the SSH agent and add your key

Git Bash / CMD (recommended):

PowerShell (run as Administrator):

✅ Git Bash is easier here. The PowerShell method makes the agent a persistent Windows service that survives reboots, but the Git Bash method works fine for most people.

Step 4 - Copy your public key

Select and copy the entire output, it starts with ssh-ed25519 ... and ends with your email.

⚠️ Make sure you copy id_ed25519.pub (the public key), NOT id_ed25519 (the private key). Never share the private key with anyone.

Step 5 - Add the key to GitHub

  • Go to github.com/settings/ssh
  • Click New SSH key
  • Give it a title (e.g. My PC)
  • Paste your public key into the Key field
  • Click Add SSH key

Step 6 - Test the connection

First time running this, you will see a prompt asking if you trust GitHub's host fingerprint. Type yes and hit Enter, it only asks once, then saves it permanently.

You should then see:

✅ That message is success. The "does not provide shell access" part is normal, SSH for GitHub is only for git operations, not terminal access.

Step 7 - Use SSH URLs

When cloning, use the SSH url instead of HTTPS:

For repos you already cloned via HTTPS, switch them over:

PS - Notes on confusing bits & common mistakes

The trailing ~ typo
A very easy mistake: accidentally typing ~ at the end of a command, like cat ~/.ssh/id_ed25519.pub~. That ~ at the end is not the home directory shorthand anymore, it becomes part of the filename and you get a "No such file or directory" error. Just remove it.

id_ed25519 vs id_ed25519.pub
You have two files. id_ed25519 is your private key, never share it, never paste it anywhere. id_ed25519.pub is your public key, this is what you paste into GitHub. Always double-check you are copying the .pub file.

Git Bash agent vs PowerShell agent
When you start the agent with eval "$(ssh-agent -s)" in Git Bash, it only lives for that terminal session. Close Git Bash and reopen it, and you need to run both commands again. The PowerShell method registers it as a real Windows background service so it survives reboots, but it requires Admin rights and PowerShell not crashing on you.

What ed25519 actually is
It stands for Edwards-curve Digital Signature Algorithm using Curve25519. The 25519 comes from the prime number 2²⁵⁵ - 19 used in the underlying math. You don't need to understand the math, just know it's the modern recommended algorithm, faster and more secure than RSA at equivalent strength.

HTTPS vs SSH - what's the difference?
Both let you push and pull from GitHub. HTTPS asks for your username and password (or a personal access token) every time. SSH uses your key pair so you never need to enter credentials again, much smoother for daily use.

Written as a personal reference. If you found this useful, you probably also forget things a lot. We're the same.

Share this post