GitHub SSH Key Registration Guide
Learn how to register an SSH key on your GitHub account to clone repositories and authenticate without entering your password every time.
๐ Overview
SSH (Secure Shell) is a protocol that allows secure authentication without sending your password over the network. By registering an SSH key pair on GitHub, you can clone, pull, and push repositories without entering credentials each time.
GitHub supports two types of SSH keys:
- Ed25519 (recommended) โ modern, secure, and smaller key size
- RSA (4096-bit) โ legacy compatibility, use only if Ed25519 is not supported by your system
๐ ๏ธ Setup Steps
1. Check for Existing SSH Keys
Before generating a new key, check if you already have one.
Linux / macOS / WSL:
ls -la ~/.ssh/
Windows (PowerShell):
Get-ChildItem $env:USERPROFILE\.ssh
Look for files named id_ed25519, id_ed25519.pub, id_rsa, or id_rsa.pub. If you already have a key pair you want to use, skip to Step 3.
2. Generate a New SSH Key
Generate a new SSH key using the Ed25519 algorithm (recommended).
Linux / macOS / WSL:
ssh-keygen -t ed25519 -C "<your-email@example.com>"
Windows (PowerShell):
ssh-keygen -t ed25519 -C "<your-email@example.com>"
When prompted for a file location, press Enter to accept the default (~/.ssh/id_ed25519).
When prompted for a passphrase, you may enter a secure passphrase or press Enter to leave it empty. Using a passphrase adds an extra layer of security.
3. View and Copy Your Public Key
Display your public key and copy it to your clipboard.
Linux / macOS / WSL:
cat ~/.ssh/id_ed25519.pub
Windows (PowerShell):
Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub
The public key starts with ssh-ed25519 or ssh-rsa and ends with your email address. Select the entire output and copy it.
โ ๏ธ Security Notice: Never share or publish your private key (
id_ed25519without.pub). Only the public key (id_ed25519.pub) is safe to share.
4. Register the Key on GitHub
- Log in to GitHub
- Click your profile photo โ Settings
- In the left sidebar, click SSH and GPG keys
- Click New SSH key
- In the Title field, enter a descriptive label (e.g.,
My Laptop,Office Desktop) - In the Key field, paste your public key
- Click Add SSH key
5. Test the Connection
Verify that your SSH key is registered correctly.
ssh -T git@github.com
You may see a warning like this the first time:
The authenticity of host 'github.com (IP ADDRESS)' can't be established.
RSA key fingerprint is SHA256:xxxxx.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Type yes and press Enter. If successful, you will see:
Hi <username>! You've successfully authenticated, but GitHub does not provide shell access.
6. Clone a Repository Using SSH
After confirming the connection, clone repositories using the SSH URL.
git clone git@github.com:<owner>/<repository>.git
Replace <owner> with the repository owner and <repository> with the repository name.
๐ Verify SSH Key Registration
To list all registered SSH keys on your GitHub account:
- Go to Settings โ SSH and GPG keys
- View the list of registered keys with their titles and creation dates
๐ฉบ Troubleshooting
| Symptom | Cause | Solution |
|---|---|---|
Permission denied (publickey) | No SSH key registered, or wrong key used | Verify your public key is registered on GitHub. Make sure you are using the correct private key. |
ssh -T says "successfully authenticated" but git operations fail | Key not added to the specific repository | Ensure your SSH key has read/write access to the repository in its settings. |
| Connection timeout | Firewall or network issue blocking port 22 | Check your network settings, or try using HTTPS instead. |
git@github.com: Permission denied | Wrong remote URL format | Use git@github.com: (colon) not https://github.com/ in your remote URL. |
| "Too many authentication failures" | Server rejects due to too many key attempts | Use ssh -vT git@github.com to debug, or specify the key with -i ~/.ssh/id_ed25519. |
๐ Security Best Practices
- Never share your private key (
id_ed25519orid_rsa). Do not attach it to issues, emails, or commit it to repositories. - Use a passphrase when generating your SSH key to protect the private key even if your machine is compromised.
- Use a unique SSH key per device โ register different keys for your laptop, desktop, and servers.
- Regularly audit registered keys โ remove old or unused SSH keys from your GitHub account.
- Consider using SSH certificates for organizations that need centralized key management.
๐ References
- GitHub Docs: About SSH
- GitHub Docs: Generating a new SSH key
- GitHub Docs: Adding a new SSH key
- OpenSSH Documentation
Version: 1.0
Last Updated: 2026-09-24
Source: giipv3/public/help/github-ssh-key.en.md