I am using redhat6
, Jenkins ver. 1.609.3
,java1.6_45
and git 2.0.5
.
While cloning the Bitbucket repository with Jenkins I am getting bellow error.
Failed to connect to repository : Command "/usr/local/git/bin/git -c core.askpass=true ls-remote -h git@bitbucket.org:DrunkenCooder/spring3helloworld.git HEAD" returned status code 128:
stdout:
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
This is the path for my git executable
/usr/local/git/bin/git
When I go there cd / /usr/local/git/bin and execute the command
git ls-remote -h git@bitbucket.org:DrunkenCooder/spring3helloworld.git
It is getting executed successfully. and I get the bellow output
b148eb99dead9a288afb0c9e6f6e87ae7aa133fe refs/heads/master
Steps I followed to connect Jenkins with Bitbucket
created
id_rsa
and id_rsa.pub
key usingssh-keygen
which is there in default location. that is
home/usrname/.ssh
copy the content ofid_rsa.pub
key inBitbucket
.- Copied both id_rsa and id_rsa.pub file in
/var/lib/jenkins/.ssh
- Change the permission of both file to
- at first i had generated the key being superuser. I deleted those
file and again generated the key using user. copied the content of
id_rsa.pub
inBitbucket
. This also dint work
tried all the solution from here Stack-overflow solution for the same error but dint work. What am I missing? any idea.