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.puborid_rsa.pub: You already have a key! Skip to Step 3. - If you see “File Not Found” or no
.pubfiles: You need to create one. Proceed to Step 2.
WARNING
id_ed25519(orid_rsa): This is your Private Key. Never share this.id_ed25519.pub(orid_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.pubReplace
id_ed25519.pubwith 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.com → Settings (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…”