Github Authentication Setup


So, you’ve installed Git, written some code, and now… boom—GitHub says:
“Permission denied (publickey).”
Don’t worry, it’s not you—it’s your missing SSH authentication. Let’s fix that.
Step 1: Generate Your SSH Key
Run this in your terminal (replace with your email):
ssh-keygen -t ed25519 -C "your_email@example.com"
Step 2: Add the Key to Your SSH Agent
ssh-add ~/.ssh/id_ed25519
Step 3: Copy the Public Key
cat ~/.ssh/id_ed25519.pub
Now head to GitHub → Settings → SSH and GPG keys → New SSH key. Paste it. Save it. Done.
Give the title a random name that you can recognize then paste the key.
Step 4: Test the Connection
ssh -T git@github.com
If all went well, GitHub will greet you with:
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
That’s success.😁
Step 5: Set Your Git Identity
Finally, tell Git who you are:
git config --global user.name "Your GitHub Username"
git config --global user.email "your_email@example.com"
Now your terminal and GitHub are officially best friends. Push your code with confidence, no more “permission denied” headaches.
Subscribe to my newsletter
Read articles from Md Sakib Sadman Badhon directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Md Sakib Sadman Badhon
Md Sakib Sadman Badhon
Hello, I’m Badhon. I tend to forget things easily, which is why I started this blog.