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
Authorize your public key on a VPS server (for passwordless SSH login):
cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys
On the server — append your public key to the authorized_keys file, then lock down permissions.
4
Go to GitHub → Settings → SSH and GPG keys → New SSH key, paste your key, and save.
5
Test that it works:
ssh -T git@github.com
"Hi username! You've successfully authenticated..."
6
Switch existing repos from HTTPS to SSH:
git remote set-url origin git@github.com:user/repo.git
Done. No more credential prompts — ever.