Git Error: Permission denied (publickey)
Git Error: Permission denied (publickey)
Date posted: 04/04/2019
Introduction
Usually this kind of error will occur for different kind of issues. One of the cause is if remote machine doesn’t match with local machine’s public key or doesn’t have public key. It is solvable.
Prerequisites
If you generate key without root, better use sudo. Because you will not use the same key for command with sudo.
Check the connection
Connect the remote GitHub server using ssh command.You will get response like below.You can use -v option with your ssh command to see the details.
This means, on your local machine, you haven’t made any SSH keys. Not to worry.Go to ~/.ssh/id_rsa.pub.Copy the key then do the following process.
1.Login to your GitHub account online.
2.Go to Settings.
3.Select SSH and GPG keys.
Here we have to save the public key that you have your local machine’s ~/.ssh/id_rsa.pub.
Click on New SSH key.paste the public key from your local machine without any extra space or a character.Then save the key with your preferred title.
Now try ssh connection from command line.It will work.
Note:If you don’t have ssh public key you have to generate a new key using ssh-keygen command.
Thanks for using pheonixsolutions.
You find this tutorial helpful? Share with your friends to keep it alive.