When it’s time to ssh into a server or push a project to a git repo, developers tend to face a common problem: Github for example:
email@example.com: Permission denied (publickey)
fatal: Could not read from remote repository.Please make sure you have the correct access rights and the repository exists.
What does this mean and how to fix it?
This means a public key exists on the server but the private key hasn’t been added to the ssh authentication agent. The ssh authentication agent is a process that executes single sign-on without providing a username and password.
To find out if any ssh identities
The agent has no identities.
To add an identity, navigate to the directory where the key-pair was created and the private key.
ssd-add -k .ssh/github_priv
Enter passphrase for github_priv
Check to see the identity list
Now that an identity has been added, the ssh connection will be resolved