SSH keys are used for Git operations (cloning/pushing) and secure shell access. They are not the same as OpenPGP keys (which you use for encrypted email). This page walks you through creating an SSH key, adding it to GitHub, and testing it.
Run this once on each device. It creates a private key (keep secret) and a public key (safe to share).
ssh-keygen -t ed25519 -a 64 -C "your_email@example.com"
ssh-keygen -t ed25519 -a 64 -C "your_email@example.com"
Keys are typically saved in: ~/.ssh/
Never share your private key.
The agent holds decrypted keys in memory so you don’t type your passphrase constantly.
Open PowerShell as Administrator to configure and start the SSH agent service (the first two commands). Once the service is running, use a normal PowerShell window to add your key.
Get-Service ssh-agent | Set-Service -StartupType Automatic Start-Service ssh-agent ssh-add $env:USERPROFILE\.ssh\id_ed25519
eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_ed25519
Windows (PowerShell):
type $env:USERPROFILE\.ssh\id_ed25519.pub
Linux / macOS:
cat ~/.ssh/id_ed25519.pub
The first time, you may be asked to trust GitHub’s host key (normal). Before accepting it, compare the fingerprint shown with the ones published in GitHub’s official documentation.
ssh -T git@github.com
Use host aliases in ~/.ssh/config:
Host github.com HostName github.com User git IdentityFile ~/.ssh/id_ed25519 Host github-work HostName github.com User git IdentityFile ~/.ssh/id_ed25519_work
Then clone with: git@github-work:ORG/REPO.git