SSH Setup for GitHub
This guide details the steps to set up SSH authentication for Git and GitHub access.
Austin Mula

Prerequisites
- Git installed
- GitHub account
- Email: testuser@gmail.com
- Username: testuser
Step 1: Check for Existing SSH Keys
Check for Existing SSH Keys
ls -la ~/.sshLook for files like id_rsa.pub, id_ed25519.pub, or id_ecdsa.pub. If you have one, you can skip to Step 4.
Step 2: Generate a New SSH Key
Generate an SSH key using Ed25519 algorithm:
Generate an SSH key using Ed25519 algorithm:
ssh-keygen -t ed25519 -C "testuser@gmail.com"Options:
- Press Enter to accept the default file location (
~/.ssh/id_ed25519) - Enter a passphrase (optional but recommended for extra security)
- Or use
-N ""flag to skip passphrase
Alternative for older systems: If your system doesn't support Ed25519, use RSA:
Alternative for older systems: If your system doesn't support Ed25519, use RSA:
ssh-keygen -t rsa -b 4096 -C "testuser@gmail.com" Step 3: Start SSH Agent and Add Your Key
Start the ssh-agent in the background:
Start the ssh-agent in the background
eval "$(ssh-agent -s)"Step 4: Display Your Public Key
View your public SSH key:
View your public SSH key:
cat ~/.ssh/id_ed25519.pubCopy the entire output (starts with ssh-ed25519 and ends with your email).
Step 5: Add SSH Key to GitHub
- Go to GitHub SSH settings: https://github.com/settings/keys
- Click "New SSH key" or "Add SSH key"
- In the "Title" field, add a descriptive label (e.g., "Austin-Lenovo", "Work Laptop")
- Paste your public key into the "Key" field
- Click "Add SSH key"
- Confirm with your GitHub password if prompted
Step 6: Add GitHub to Known Hosts
Add GitHub's host key to avoid verification prompts:
Bash
ssh-keyscan -t ed25519 github.com >> ~/.ssh/known_hostsStep 7: Test the SSH Connection
Test your SSH connection to GitHub:
Bash
ssh -T git@github.comYou should see a message like:
Bash
Hi testuser! You've successfully authenticated, but GitHub does not provide shell access.