ProjectStack
git

Permission denied (publickey)

SSH authentication failed because Git couldn't find a valid SSH key accepted by the remote server. Either no key is configured, the wrong key is being used, or the key isn't added to your GitHub/GitLab account.

Common causes

  • Your SSH key isn't added to GitHub/GitLab under Settings → SSH Keys
  • The ssh-agent isn't running or doesn't have your key loaded
  • You have multiple SSH keys and the wrong one is being used
  • The key was deleted from the remote service but still exists locally

How to fix it

  1. Check if your key is loaded: ssh-add -l
  2. Add your key to the agent: ssh-add ~/.ssh/id_ed25519
  3. Test SSH connection: ssh -T [email protected]
  4. Add your public key to GitHub: cat ~/.ssh/id_ed25519.pub and paste into Settings → SSH Keys

Example

[email protected]: Permission denied (publickey). fatal: Could not read from remote repository.

Using SSH remote URL without an SSH key registered on GitHub

Have a different error?

Paste any error message into the Error Translator to get an instant explanation.