How to fix SSH Permission denied (publickey)

How to fix SSH Permission denied (publickey)

Image for post

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: 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

ssh-add -lThe 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_privEnter passphrase for github_priv

Check to see the identity list

ssh-add -l

Now that an identity has been added, the ssh connection will be resolved

No Responses

Write a response