Varun
Varun

Reputation: 4452

Not able to connect Jenkins with Bitbucket

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 [email protected]: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.

error screen short

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 [email protected]: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

  1. created id_rsa and id_rsa.pub key using ssh-keygen

    which is there in default location. that is home/usrname/.ssh copy the content of id_rsa.pub key in Bitbucket.

  2. Copied both id_rsa and id_rsa.pub file in /var/lib/jenkins/.ssh
  3. Change the permission of both file to
  4. 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 in Bitbucket. 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.

Upvotes: 0

Views: 671

Answers (1)

Alex Skiffin
Alex Skiffin

Reputation: 419

Try change:

  1. repository address to https://bitbucket.org/DrunkenCooder/spring3helloworld.git
  2. /usr/local/git/bin/git to simple git

Upvotes: 1

Related Questions