Search code examples
jenkinssshbitbucketssh-keys

Jenkins: stderr: Permission denied (publickey) error not resolving


I have setup SSH key on CENTOS 7 server and also have added SSH in my Bitbucket personal settings. But still I am getting Jenkins error as:

enter image description here

Although I have setup ssh key on CENTOS 7 server where the Jenkins is installed. On running ssh -v git@bitbucket.org command in terminal I am getting a number of lines and it seems that the connection has been established successfully. The terminal output was:

enter image description here

But still I am getting authentication error.

I have tried other solutions like Jenkins Shared Library: Permission denied (publickey) and Jenkins : stderr: Permission denied (publickey). fatal: The remote end hung up unexpectedly But none of them worked. Please help me.


Solution

  • I think your Repository URL is not correct. If you have setup SSH connection in bitbucket then you should use url accordingly.

    • Go to Bitbucket and click on clone button ion your repository.
    • Select SSH on the top right of the dialogue being displayed.
    • Copy the url written after git clone keyword. It will go like git@..... That should work.