Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 installed Jenkins on my system.

What I am trying to do is clone the BitBucket repository with Jenkins so that I will be able to build the project.

Steps what I am following is

  1. Creating a new Job In Jenkins.
  2. Giving a description of 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 https://[email protected]/UserName/java-script.git HEAD

I spent 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.

like image 800
Varun Avatar asked Jun 25 '15 08:06

Varun


People also ask

How to configure Bitbucket repository in Jenkins?

Configure your Jenkins job with Bitbucket repository details Configure Bitbucket Repository under Source Code Management, along with credentials. 3. Verify your Jenkins configuration looks ok 4. Configure a Webhook on Bitbucket On Bitbucket, go to Settings — Webhook — Add Webhook.

How to remove the Git clone in Jenkins?

Please go to Manage Jenkins-> Configure System Settings. Check for git section and add correct path. Its already seems that you have removed the Git Clone from the URL provided by Bitbucket. You can find this setting under Global tool configuration.

What is a Bitbucket clone?

Bitbucket provides different features to developers to make easy development. The clone is one of the features that Bitbucket provides. When we try to clone a repository at that time, we need to create a copy of the Bitbucket repository on our local machine.

How do I clone a git repository in Bitbucket?

When you clone a repository, you create a copy of your Bitbucket repository on your local system. Cloning also connects the remote and local repositories so that you can start pushing and pulling changes between both places. You can use the terminal, SourceTree, or any other client you'd like to clone your Git repository.


1 Answers

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.

Update:

For Jenkins 2.0 or above

You can find this setting under Global tool configuration.

like image 100
Abhijeet Kamble Avatar answered Oct 27 '22 00:10

Abhijeet Kamble