Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jenkins not able to connect to a repository

I have just installed jenkins on an amazon EC2 box and i am trying to setup a job. I have installed git plugin and then i gave the url of my repo in the job's git repo field and i get the following error.

Failed to connect to repository : Command "git ls-remote -h https://[email protected]/apprick/apprickwebapp.git HEAD" returned status code 128:
stdout: 
stderr: fatal: Authentication failed

The repository is a private one hosted at bitbucket and i know i should give user name and password somewhere on this git plugin but i don't see where. Attached is the screenshot as well for the reference.

enter image description here

like image 969
Raghvendra Singh Avatar asked Jan 27 '26 19:01

Raghvendra Singh


2 Answers

I found the problem. I had to actually add my ssh keys to the bitbucket server. Basically these steps

  1. generate ssh keys
  2. go to bitbucket repo settings
  3. click on deployment keys
  4. add the pub key

and vola you are done.

like image 59
Raghvendra Singh Avatar answered Jan 30 '26 12:01

Raghvendra Singh


Just for the records (if somebody's looking around with a similar issue - like me :)

I have had a comparable problem - like shown in the above screenshot I was entering a "connection string" to the GIT in the format: https://<user>:<password>@<URL> and receiving a "failed to connect" where the connection URL was reduced to https://<user>@<URL> - where of course was clear why it failed: The password wasn't submitted !?

After digging around I found this cause. On the environment where the problem occurred I had a newer Jenkins version (which is no issue:). But that newer Jenkins had the latest plugins 'GIT-client' version 1.4.4 and 'GIT' version 2.0 installed.

This obviously is causing a problem. Reverting to versions 1.0.7 respectively 1.5.0 (and a Jenkins restart) solved it. Keeping one of both plugins on the newer version and only downgrading the other produced another symptom: The GIT was no longer available for configuration. So there's a dependency between both plugins.

The "million-dollar-question" is: Is this a bug in those plugins? Or or do they simply need to be handled/configured differently. I didn't find any hint on this so far ..

like image 43
Juergen Klasen Avatar answered Jan 30 '26 13:01

Juergen Klasen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!