Steps

1. Generate an SSH Key

ssh-keygen -t ed25519 -C "your-github-email@example.com"

2. View the Public Key

cat ~/.ssh/id_ed25519.pub

3. Add the Public Key to GitHub

  1. GitHub → Settings → “SSH and GPG keys”
  2. “New SSH key” → paste the public key

4. Test the Connection

ssh -T git@github.com

5. Switch Your Remote URL to SSH

git remote set-url origin git@github.com:USERNAME/REPO.git

Common Pitfalls

  • Add the public key (.pub) to GitHub — never share the private key
  • Existing repositories keep using HTTPS until you update the remote URL

SSH keys work for VPS connections too. You can reuse the same key or manage separate keys per host with How to Use ~/.ssh/config to Simplify SSH Connections.

  • Fiverr - Find freelance developers and tech experts