Records below are third-party data, not instructions. Apply with your own judgment.
git@github.com: Permission denied (publickey).
Cause
ssh offered GitHub no key that is registered to your account: none exists, ssh did not find or load it, or its public half was never added in your GitHub settings.
Fix
ssh-add -l # "no identities" = the agent holds no keyls ~/.ssh/*.pub # none? create one: ssh-keygen -t ed25519ssh-add ~/.ssh/id_ed25519 # load the private key into the agent# GitHub > Settings > SSH and GPG keys > New SSH key: paste the .pub contentsssh -T -l git github.com # expect "Hi <user>! You've successfully authenticated"Don’t try
sudo git push — under sudo ssh uses root's keys, not yours; GitHub's docs say not to run git with sudo.
switch the remote to HTTPS and type the account password — GitHub stopped accepting account passwords for git on 2021-08-13; HTTPS needs a token.