🔐 How to Connect GitHub with SSH on Windows (No Nonsense Guide)

Tired of typing your GitHub username and password every time you push or clone? Setting up SSH solves that. It’s secure, simple, and once you do it, you’ll never go back.

Follow this guide and you’ll be cloning your GitHub repos via SSH like a pro.

What You Need

  • A GitHub account

  • Git for Windows installed (includes Git Bash)

👉 If you don’t have Git yet: Download here

🔧 Step 1: Generate Your SSH Key

  1. Open Git Bash

  2. Run this command:

bashCopyEditssh-keygen -t ed25519 -C "your_email@example.com"
  1. When asked where to save, just press Enter (default is fine).

  2. You can enter a passphrase or just hit Enter to skip.

✅ Done. Your key is now stored in C:\Users\YourName\.ssh\


🔑 Step 2: Start SSH Agent & Add Your Key

Still in Git Bash:

bashCopyEditeval "$(ssh-agent -s)"

Then:

bashCopyEditssh-add ~/.ssh/id_ed25519

📎 Step 3: Copy Your Public Key

Run:

bashCopyEditcat ~/.ssh/id_ed25519.pub

Copy everything that comes out (starts with ssh-ed25519).


🌐 Step 4: Add Key to GitHub

  1. Go to GitHub SSH Keys

  2. Title: Write something like My Windows Laptop

  3. Key: Paste what you copied

  4. Click Add SSH Key


✅ Step 5: Test the Connection

Back in Git Bash:

bashCopyEditssh -T git@github.com

If it asks “Are you sure you want to continue connecting?” → Type yes

If it replies with:

rustCopyEditHi your-username! You've successfully authenticated...

🎉 Boom. It’s working.


🚀 Step 6: Clone Repos with SSH

From now on, use the SSH link (not HTTPS) when cloning repos.

Example:

bashCopyEditgit clone git@github.com:your-username/your-repo.git

You’ll never need to enter username or password again.


🧠 Optional: Set SSH as Default for GitHub

So you don’t accidentally use HTTPS again:

bashCopyEditgit config --global url."git@github.com:".insteadOf "https://github.com/"

Now even if you copy-paste an HTTPS link, Git will use SSH automatically.


💬 Final Thoughts

SSH setup might sound techy, but as you saw — it's just a few commands and some copy-paste. Once it's done, GitHub becomes way smoother to use.

Use this for:

  • Cloning private repos

  • Pushing without typing your credentials

  • Working with Codespaces, VS Code, etc.


If you ever mess things up, just delete your key from GitHub and start over. No big deal.

Need a ready-to-go test repo to try cloning? Create one here

Thanks for Reading! Bye!

0
Subscribe to my newsletter

Read articles from MUHAMMAD ZAIN UL ABIDIN directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

MUHAMMAD ZAIN UL ABIDIN
MUHAMMAD ZAIN UL ABIDIN