Reputation: 111062
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 git@coding-squirrel.de:iRest.git
ERROR: Cause: Error performing command: /usr/local/git/ clone -o origin git@coding-squirrel.de: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)
Upvotes: 55
Views: 239575
Reputation: 9971
I was getting the same error, even after my Path to Git executable
was correct:
Though, I was getting error:
This is how I resolved:
Step 1: I updated the following git plugins
Step 2: Restarted Jenkins by plugin "Restart Safely"
Step 3: Started the build, and it worked
Upvotes: 1
Reputation: 2106
i installed git on the node server with sudo apt-get install git
and the error is gone, now i got an ssh key verification error while cloning from github (Host key verification failed)
Upvotes: 0
Reputation: 19
I am also faced the same issue One day all jenkins pipelines started showing the below errors , previously it was working fine :- git command not found , error in initializing
If you are facing this issue while running the pipeline first then you can go answers like tool location and more
In my case I have installed the restart safely plugin and restarted the jenkins and rerunned the pipeline and it is worked
I struggled for an almost 3 hours but restart worked for me
Upvotes: 0
Reputation: 1106
Also you can set Git location in Jenkins server/node configuration:
Goto Configure, under section Node Properties mark checkbox Tool Locations and set your path to Git.
Upvotes: 39
Reputation: 2106
I had the same error, the problem was git not configured in jenkins, so the pipeline could not checkout the project.
To specify the Git path for Jenkins go to Dashboard > Manage Jenkins > Global Tool Configuration and set the path in the Path to Git executable field.
To verify if git is installed on you system run the command line
git --version
the result should look like
git version 2.34.1
if the result is command 'git' not found, can be install with.., then run the command like indicated:
apt install git
To know where Git is installed run the command line (for Linux users)
whereis git
another way is to install the git plugin in jenkins. You can check this link to know how: https://www.tutorialspoint.com/jenkins/jenkins_git_setup.htm
Upvotes: 1
Reputation: 22385
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.
Upvotes: 1
Reputation: 53153
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 /usr/local/bin/git
.
Upvotes: 100
Reputation: 11
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.
Upvotes: 1
Reputation: 1109
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:
Upvotes: 5
Reputation: 353
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 It works!
In Jenkins, give the http URL. SSH URL shows similar error.
Upvotes: 0
Reputation: 1722
I had similar problem, the solution for Windows looks the same (my Jenkins is installed on a Windows machine):
Global settings:
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: C:\Program Files\Git\bin\git.exe
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.
Upvotes: 5
Reputation: 41
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.
Upvotes: 1
Reputation: 919
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.
Upvotes: 0
Reputation: 7880
It seems Jenkins has been changing a lot. I fixed this problem in March 2017 by doing this:
Git / Path to Git executable
enter C:\<whatever the path is>\git.exe
.Upvotes: 24
Reputation:
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
Upvotes: 0
Reputation: 813
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.
Upvotes: 3
Reputation: 4857
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 %userprofile%/.ssh
to C:\Program Files (x86)\Git\.ssh
and the problem is resolved.
Upvotes: 2
Reputation: 36
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.
Upvotes: 1