How to clone a BitBucket repository with Jenkins
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.
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.
Related videos on Youtube
Varun
Updated on September 16, 2022Comments
-
Varun over 1 year
I am using RedHat Linux
- I have created a repository in
BitBucket
say Demo and I have someHTML
code into that. - I have installed
Jenkins
on my system.
What I am trying to do is clone the
BitBucket
repository withJenkins
so that I will be able to build the project.Steps what I am following is
- Creating a new Job In
Jenkins
. - Giving a description of the project
- In the Source Code Management tab selecting
git
andJenkins
ask for repository URL, and I am giving this URL.
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 theBitBucket
plug-in forJenkins
that also was not working.-
nwinklerpossible duplicate of How to configure jenkins with bitbucket
- I have created a repository in
-
Varun almost 9 yearsWhen I am giving the whole URL git clone [email protected]/DrunkenCooder/java-script.git , it throws this "Failed to connect to repository : Error performing command: git ls-remote -h git clone [email protected]/DrunkenCooder/java-script.git HEAD "
-
Varun almost 9 yearsWhen I am giving only URL [email protected]/DrunkenCooder/java-script.git , it throws this " Failed to connect to repository : Error performing command: git ls-remote -h [email protected]/DrunkenCooder/java-script.git HEAD"
-
Bruno Lavit almost 9 yearsOn your Jenkins server, are you able to run the git clone http//... command?
-
Varun almost 9 yearscorrect path. in the sense the Bitbucket path which I have shown in the above scree
-
Abhijeet Kamble almost 9 yearsno not the bitbucket path. i am talking about the path where git is installed on your system. for ex. my machine is linux(centos 6.5) and in my case git is installed at /usr/local/bin/git. or if its windows it might be C:\Program Files\Git\bin\git.exe
-
Abhijeet Kamble almost 9 yearsthe bitbucket path is correct. [email protected]/DrunkenCooder/java-script.git
-
Varun almost 9 yearsSorry bro i have not installed git in my system. I'll just do that. but, why do we need git since we are pulling the code from Bitbucket ?
-
Abhijeet Kamble almost 9 yearsJenkins doesn't comes with GIT,So we have to install GIT and have to tell Jenkins about GIT path so that Jenkins can run GIT commands at backend. Hope this has answered your question.
-
Varun almost 9 yearsAfter installing git and after giving the path I am getting this error
-
Varun almost 9 yearsCould not init /tmp/hudson4551896643487321839tmp
-
Varun almost 9 yearsas u have mention I have specified the git executable path /usr/bin/git . now I have getting this error "Failed to connect to repository : Command "/usr/bin/git config --local credential.helper store --file=/tmp/git3516666924035828487.credentials" returned status code 129: stdout: stderr: error: unknown option `local' usage: git config [options] Config file location --global use global config file --system use system config file -f, --file <FILE> use given config file
-
vaskort over 7 yearsinstead of
Configure System Settings
in Jenkins 2.27 it's calledGlobal Tool Configuration
-
Abhijeet Kamble over 7 years@BillK Yes you are right, Now from Jenkins 2 its defined under Global Tool Configuration.