Jenkins - Get Code from BitBucket with SSH

I created a private key and added the public key to my keys on the bitpack, as described in this tutorial

I am trying to add a private key to Jenkins in the Credentials menu, but it just says:

Failed to connect to repository : Command "C:\Program Files\Git\cmd\git.exe -c core.askpass=true ls-remote -h git@bitbucket.org :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 with Jenkins?

Thanks.

0
git bitbucket ssh ssh-keys jenkins
source share
1 answer

I had a similar problem with Jenkins. Then in the setup of my work, I noticed this

For the remote super project URL, the end of the URL determines whether the bare or non-poor repository is supposed to be:

  • If the remote URL ends with /.git, an insecure repository is assumed.
  • If the remote URL does NOT end with /.git, it is assumed that the repository is bare.

Now I'm not sure why the documentation is /.git, but it made me try my repo url without the suffix .git, since the repo in bitbucket is good.

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

 git@bitbucket.org :bla/blabla 

Please note that ".git" has been deleted.

0
source share

All Articles