Page 1 of 1

github: permission denied (publickey)

Posted: Wed Mar 06, 2024 10:00 pm
by peter_b
I've had several reasons for the following error:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
1. SSH config (~/.ssh/config) had no public key set.
2. Remote-URL wasn't pointing to any SSH config entry name.
(eg "github.com" instead of just "github" - as labelled in ~/.ssh/config)
3. SSH key was not assigned to any user who had access to that repository (eg: my own account)