Hi in this blog I will be teaching how to setup ssh key in github
1. Check for Existing SSH Keys
Open terminal and run:
ls -al ~/.ssh
If you see files like:
id_rsa.pub
id_ed25519.pub
You already have a key (you can reuse it or create a new one).
2. Generate a New SSH Key
Recommended (modern and secure):
ssh-keygen -t ed25519 -C "your_email@example.com"
If your system doesn’t support it:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Press:
Enter → save in default location
Enter → skip passphrase (or add one for security)
3. Start SSH Agent
eval "$(ssh-agent -s)"
4. Add SSH Key to Agent
ssh-add ~/.ssh/id_ed25519
5. Copy SSH Public Key
cat ~/.ssh/id_ed25519.pub
Copy the output (starts with ssh-ed25519).
6. Add Key to GitHub
Go to GitHub
Click profile → Settings
Go to SSH and GPG keys
Click New SSH Key
Paste your key
Click Add SSH Key
7. Test SSH Connection
ssh -T git@github.com
Expected output:
Hi username! You've successfully authenticated...
8. Use SSH Instead of HTTPS
When cloning a repo, use:
git clone git@github.com:username/repo.git
Example:
git clone git@github.com:akash/repo.git
Common Issues & Fixes
❌ Permission denied (publickey)
Fix:
ssh-add ~/.ssh/id_ed25519
❌ Wrong remote URL
Check:
git remote -v
Update:
git remote set-url origin git@github.com:username/repo.git
❌ SSH not running
Restart:
eval "$(ssh-agent -s)"
Thanks for reading this blog.

