This could be a common issue while using git bash in windows.
Before fixing this issue, it is assumed that the public/private key pair is generated and the public key is configured in the git server (github, bitbucket or whatever).
Still, if you get the "Permission denied (publickey)." which means, the ssh agent might not have recognized your key. To solve this you'll have to make sure the ssh agent is running and the key is added.
Run the ssh agent, execute the below command in git bash
exec ssh-agent bash
To check if the key is added run the below command.
ssh-add -l
If there is no key, it will print "The agent has no identities."
To add the key, run the below command with the path to your private key.
ssh-add ~/.ssh/thilinarsa
(My key file is located in C:/User/Thilina/.ssh/thilinarsa)
If you run the ssh-add -l command again you should see the key file added.
Run the git clone or pull command again and see if it works!
Comments
Post a Comment