0
votes

I Created a private key and added the public key to my keys on bitbucket just like explained in this tutorial

I'm trying to add the private key to Jenkins under Credentials menu but it just keep saying:

Failed to connect to repository : Command "C:\Program Files\Git\cmd\git.exe -c core.askpass=true ls-remote -h [email protected]:bla/blabla.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.

What am i doing wrong withing Jenkins?

Thanks.

1

1 Answers

0
votes

I had a similar problem with Jenkins. Then in the configuration help of my job I spotted this

For a remote URL to a super-project, the ending of the URL determines whether a bare or non-bare repository is assumed:

  • If the remote URL ends with /.git, a non-bare repository is assumed.
  • If the remote URL does NOT end with /.git, a bare repository is assumed.

Now I'm not sure why the documentation the /.git but this led me to try my repo url without the .git suffix, since a repo in bitbucket is bare.

so in your case I would try setting the repo url to:

[email protected]:bla/blabla

Note the ".git" has been removed.