Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins could not run git

Tags:

git

jenkins

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 protected]:iRest.git ERROR: Cause: Error performing command: /usr/local/git/ clone -o origin [email protected]: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) 
like image 669
Andreas Köberle Avatar asked Dec 26 '11 22:12

Andreas Köberle


People also ask

How do I run a git project in Jenkins?

Step 1: go to your GitHub repository and click on 'Settings'. Step 2: Click on Webhooks and then click on 'Add webhook'. Step 3: In the 'Payload URL' field, paste your Jenkins environment URL. At the end of this URL add /github-webhook/.

Can we connect git with Jenkins?

With the help of the Git plugin Jenkins can easily pull source code from any Git repository that the Jenkins build node can access. The GitHub plugin extends upon that integration further by providing improved bi-directional integration with GitHub.

Is git required for Jenkins?

Jenkins needs to have GitHub plugin installed to be able to pull code from the GitHub repository. You need not install a GitHub plugin if you have already installed the Git plugin in response to the prompt during the Jenkins' installation setup.

How do I download git Jenkins plugin?

Install the Git Plugin in JenkinsGo to “Manage Jenkins>>Manage Plugins”, open the “Available” tab and search for “Git plugin”, click on install button wait until the installation is done.


2 Answers

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.

Global Tool Configuration

like image 186
Josh Brown Avatar answered Oct 05 '22 20:10

Josh Brown


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.

enter image description here

like image 44
AlekseiPetrovski Avatar answered Oct 05 '22 18:10

AlekseiPetrovski