- Home
- GitHub
- Errors and problems
- Permission denied (publickey).
Error codeGitHubGit command line
GitHub: "Permission denied (publickey)."
GitHub did not accept your SSH key
GitHub refused the SSH connection. GitHub says the usual causes are no key loaded in your SSH agent, a key that is not added to your account, the wrong user in the remote URL, or running Git with sudo.
How to fix "Permission denied (publickey)."
Run ssh -vT [email protected] to check that you reach GitHub on port 22.
Make sure the remote URL uses the git user, not your GitHub username.
Start the ssh-agent and run ssh-add -l to check that a key is loaded.
Compare that key's fingerprint with the keys under Settings, SSH and GPG keys on GitHub, and add it if it is missing.
Run Git without sudo so it uses your own keys.
From GitHub's help pages: docs.github.com, in our words. Checked on 5 November 2026. If the steps do not help, GitHub's own support is the next stop.