varun varun - 1 year ago 331
Git Question

How to clone a Bitbucket repository with Jenkins

I am using RedHat linux

  1. I have created a repository in Bitbucket say Demo and I have
    some HTML code into that.

  2. I have install Jenkins in my system.

What I am trying to do is clone the Bitbucket repository with Jenkins so that i can build the project.

Steps what I am following is

  1. Creating a new Job In Jenkins.

  2. Giving description about the project

  3. In the Source Code Management tab selecting git and Jenkins ask for repository URL, and I am giving this URL.
    enter image description here

but Jenkins throwing an error saying

Failed to connect to repository : Error performing command: git
ls-remote -h git clone HEAD

Spend around 3 days and could not configure this instead learned a lot about Jenkins.
I have also tried the Bitbucket plug-in for Jenkins that also was not working.

Answer Source

For Jenkins 1.5 or greater( till 1.6)

The error you are getting because in the global configuration of Jenkins, the git path is not correct/or not inserted.

That's why Jenkins is unable to run the git command.

Please go to Manage Jenkins-> Configure System Settings. Check for git section and add correct path.

enter image description here Its already seems that you have removed the Git Clone from the URL provided by Bitbucket.


For Jenkins 2.0 or above

You can find this setting under Global tool configuration.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download