I have a repo on Bitbucket I'm trying to connect to my Jenkins instance. Not taking the SSH key approach here but plain id/password since communications will take place in SSL.

(1) I double checked the id/password on both BitBucket and on Jenkins entry. I tried both scope of both Global and System.

(2) I added a hook on Bitbucket pointing to my Jenkins instance.

(3) Installed the proper bitbucket plugin on Jenkins.

But I'm keep on getting

     "Failed to connect to repository : Error performing command: git ls-remote -h https://bitbucket.org/id/demo HEAD" 
"Failed to connect to repository : Could not init /tmp/hudson4950610074146191608tmp" 

I searched what both errors mean but I can't determine whether this is a credential issue.

I'm out of clue as to how to proceed.

Thank you.


Check if you have install git on the Jenkins server, and check if you have set the git executable path in the Jenkins configuration

  • 1
    More specifically go to 'Manage Jenkins' -> 'Configure System' and check the 'Path to Git executable' field. Making sure that git was installed and that that path was correct fixed my "Failed to connect to repository : Could not init /tmp/hudson123...123tmp" error. – user51928 Jun 25 '15 at 20:55
  • on Jenkins ver. 2.7.4, the setting property of (Path to Git executable) is now in Manage Jenkins -> Global Tool Configuration -> Git -> Git Installations -> Path to Git executable. – cjs Sep 20 '16 at 14:59

Upon struggling for days, turns out the private key Jenkins was using had permission set incorrectly. User name and keys must match.

  • 1
    SndLt, I am also getting the same error when connecting to bitbucket from jenkins. I didnt understand your answer. Can you please elaborate on the above answer. Thanks, Vaibhav – nigava Nov 3 '14 at 20:13