THE PROBLEM
Every time you run git push or git pull, Ubuntu asks for your GitHub credentials. GitHub has deprecated plain password auth, so now you need a personal access token too — a long, ugly string you have to paste every single time. There's a better way.
THE SOLUTION — SSH AUTHENTICATION
1
Generate an SSH key pair on your machine:
ssh-keygen -t ed25519 -C "your@email.com"
Press Enter three times — accept defaults, skip passphrase.
2
Copy your public key:
cat ~/.ssh/id_ed25519.pub
Select all the output and copy it.
3
Go to GitHub → Settings → SSH and GPG keys → New SSH key, paste your key, and save.
4
Test that it works:
ssh -T git@github.com
"Hi username! You've successfully authenticated..."
5
Switch existing repos from HTTPS to SSH:
git remote set-url origin git@github.com:user/repo.git
Done. No more credential prompts — ever.