Purpose

SSH Keys are important

Steps

1. Check your keys

Enter the relevant command to check your current ssh keys:

# linux/macOS
ls -al ~/.ssh
# PowerShell
ls $HOME\.ssh
# command prompt
dir %USERPROFILE%\.ssh
  • If you see id_ed25519.pub or id_rsa.pub: You already have a key! Skip to Step 3.
  • If you see “File Not Found” or no .pub files: You need to create one. Proceed to Step 2.

WARNING

  • id_ed25519 (or id_rsa): This is your Private Key. Never share this.
  • id_ed25519.pub (or id_rsa.pub): This is your Public Key. This is the one you copy and paste into the GitHub settings.
  • known_hosts: A list of servers your computer has connected to before (like github.com)

2. Generate a new SSH key (if missing)

If you don’t have one, run this command, replacing the email used in the example with your GitHub email address (press Enter through all the prompts to keep the defaults):

ssh-keygen -t ed25519 -C "[email protected]"

3. Add your public key to GitHub

Copy the key to your clipboard :

type %USERPROFILE%\.ssh\id_ed25519.pub

Replace id_ed25519.pub with the name of the file you just created if you deferred from default key creation settings

  • Highlight the text that starts with ssh-ed25519... and copy it.
  • Go to GitHub.comSettings (top right profile icon) → SSH and GPG keys.
  • Click New SSH Key, give it a name (like the name of your device), and paste your key into the box.

4. Test your connection

Enter this command:

ssh -T [email protected]

You should see: “Hi <username>! You’ve successfully authenticated…”