Permission denied (publickey)

The server rejected every SSH key your machine offered — it has no matching public key on file for your account.

Common causes

  • The SSH key was never added to your GitHub account
  • The SSH agent isn't holding the key in the current session
  • You're authenticating as a different account than you intended

Diagnostic commands

bash
$ ssh-add -l
bash
$ ssh -vT git@github.com

Solutions

  • Re-add your key to the agent with `ssh-add ~/.ssh/id_ed25519`
  • Confirm the exact same public key is listed under GitHub → Settings → SSH and GPG keys
  • If you have multiple keys, add an explicit `Host` entry to `~/.ssh/config` pointing to the right one

Related tutorials