Permission denied (publickey) when clone git repo from bitbucket

Viewed 7238

I just created the git repo on bitbucket. Then I create the ssh key by follow:

   1. ssh-keygen -t rsa -C 'dien.vo@asnet.com.vn'
   2. ssh-keygen (press enter more)
   3. cat ~/.ssh/id_rsa.pub --> it return for me a SSH key
   4. Coppy that and added on bitbucket, then I save the new SSH key

After that I chose SSH link git like git@bitbucket.org:DienVo/abc.git, but In the terminal it show that

sign_and_send_pubkey: signing failed: agent refused operation
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I don't know what is I wrong here, please help me to resolve it.

2 Answers

I faced the same issue in Ubuntu

Need to set the permission of your ssh folder, private and, public keys.

Run the below command in terminal

chmod 700 ~/.ssh
chmod 600 ~/.ssh/*

After restarting the terminal and try to connect the ssh connection.

Related