I’ve installed Jenkins on my mac (osx lion). But I couldn’t get it work. This is the stacktrace I’ve got:
Started by user anonymous Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/test/workspace - hudson.remoting.LocalChannel@1c0a0847 Using strategy: Default Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/test/workspace - hudson.remoting.LocalChannel@1c0a0847 Cloning the remote Git repository Cloning repository origin Error trying to determine the git version: Error performing command: /usr/local/git/ --version Cannot run program "/usr/local/git/" (in directory "/Users/Shared/Jenkins/Home/jobs/test/workspace"): error=13, Permission denied Assuming 1.6 ERROR: Error cloning remote repo 'origin' : Could not clone email@example.com:iRest.git ERROR: Cause: Error performing command: /usr/local/git/ clone -o origin firstname.lastname@example.org:iRest.git /Users/Shared/Jenkins/Home/jobs/test/workspace Cannot run program "/usr/local/git/": error=13, Permission denied Trying next repository ERROR: Could not clone repository FATAL: Could not clone hudson.plugins.git.GitException: Could not clone at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1046) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:972) at hudson.FilePath.act(FilePath.java:783) at hudson.FilePath.act(FilePath.java:765) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:972) at hudson.model.AbstractProject.checkout(AbstractProject.java:1195) at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:571) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:460) at hudson.model.Run.run(Run.java:1404) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:238)
The solution for me was to set the git path in the Manage Jenkins > Global Tool Configuration settings. In the Git section, I changed the Path to Git executable to
Also you can set Git location in Jenkins server/node configuration:
goto Configure, under section Node Properties mark checkbox Tools Location and set yours path to Git.
It seems Jenkins has been changing a lot. I fixed this problem in March 2017 by doing this:
- Go to Manage Jenkins
- Go to Global Tool Configuration
Git / Path to Git executableenter
C:\<whatever the path is>\git.exe.
- Click on Save.
I had similar problem, the solution for Windows looks the same (my Jenkins is installed on a Windows machine):
Go to Manage jenkins -> Configure System -> Git installations
add there the git exe path (for example:
C:\Program Files\Git\bin\git.exe), or you can use environment variable.
For Jenkins version 2.121.3, Go to Manage jenkins -> Global tool configuration -> Git installations -> Path to Git executable:
Jenkins job side:
Go to Source code Management -> select git, add your repository, choose connection to repository (http/ssh)
and add credentials and it should work.
Like Darksaint2014 said, you need to configure two parts if you installed Jenkins in Windows.
If you installed your Jenkins in windows, you need to install Git in both local and your linux server, then configure below in both locations:
Global tool configuration:
For server side:
I had the correct path to git in Jenkins, but I had not yet accepted the Xcode build tools EULA on a fresh install of OS X Yosemite, so git looked like it was failing in Jenkins. After trying “git –version” on the git at /usr/bin/git in a terminal, I was given a command-line interface to accept the EULA, and then Jenkins could then access the git URL I had given the build project.
I had a similar problem finding the git executable on OS X.
I had to change my Path to Git executable to : /usr/local/git/bin/git
Might give that a shot if you are still stuck.
Another issue i faced with was, ssh.exe was not looking at the
%userprofile%/.ssh folder for the key files. Instead it was looking to the folder
C:\Program Files (x86)\Git\.ssh which was empty and which causes a hang due to ssh authentication prompt on the machine where git repo located.
We just copied the key files under
C:\Program Files (x86)\Git\.ssh and the problem is resolved.
Please install git in your Jenkins server. For example, if you are using Red Hat Enterprise Linux where you are hosting Jenkins, then install git in that server using the following command:
sudo yum install git
This should solve the problem as git executable will be available in /usr/bin/git then and this will be recognized automatically by jenkins and this you can verify by navigating to Manage Jenkins –> Global Tool Configuration. Then under Git installations, there will not be any warning and now you should be able to clone your git project in jenkins. Hope this help the users.
I got a very similar error when my Jenkins agent was running Java 11 instead of Java 8. It had nothing to do with configuring my git path! Downgrading the agent to Java 8 was the only solution I found.
If you do not copy and paste the full file path addess e.g.
C:\Program Files\Git\bin\git.exe, in the ‘path to executable’ field when configuring Git, it can lead to errors. Windows 8 & 10 for instance have a ‘copy path’ functionality which really works and helps to get full path name. Mac should have something similar. Its always best to use that rather clicking in the path address address bar and copying. This does not usually give the full file path and may cause a lot of troubles if you forget to edit the path at its destination.
Path copycopy is also very good add-on for copying full path
In case the Jenkins is triggering a build by restricting it to run on a slave or any other server (you may find it in the below setting under ‘configure’)
then the Path to Git executable should be set as per the ‘slave_server_hostname’ or any other server where the git commands are executed.
For Jenkins 2.121.3 version, Go to Manage jenkins -> Global tool configuration -> Git installations -> Path to Git executable: C:\Program Files\Git\bin\git.exe
In Jenkins, give the http URL. SSH URL shows similar error.
Adding “/usr/bin/git” >> Path to Git executable, didn’t work for me.
Then I deleted the contents of $JENKINS_HOME/fingerprints and restarted Jenkins. The problem goes away.
Not the answer you’re looking for? Browse other questions tagged git jenkins or ask your own question.