0

Jenkins building a simple hello world app fails with this command

Caused by: hudson.plugins.git.GitException: Command "git init /Users/jenkins/workspace/helloworld" returned status code 1:
stdout: 
stderr: xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2430)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2360)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2356)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1916)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:988)
    ... 11 more
[Pipeline] }
[Pipeline] // node
[Pipeline] }
Cloning repository https://github.com/xxx/demo_qmake_hello_world.git
 > git init /Users/jenkins/workspace/helloworld # timeout=10
[Pipeline] // stage
[Pipeline] End of Pipeline
ERROR: Error cloning remote repo 'origin'
Finished: FAILURE

Obviously the Jenkins java SSH connection does not find git on my mac. But why? Yes the execution context seems to be different, not the same PATH...But adding the PATH to the node's ENV did not work. Other people had the same issues, and only got this answer, but it just does not work.

enter image description here


Update

There is an option on the node to specify Git Tool location. I added it like this. enter image description here

Git seems to be found now. But now the permissions are unsufficient.

Caused by: java.io.IOException: Cannot run program "/usr/local/git/bin" (in directory "/Users/jenkins/workspace/helloworld"): error=13, Permission denied
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at hudson.Proc$LocalProc.<init>(Proc.java:252)
    at hudson.Proc$LocalProc.<init>(Proc.java:221)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:936)
    at hudson.Launcher$ProcStarter.start(Launcher.java:454)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2423)
    ... 15 more
Caused by: java.io.IOException: error=13, Permission denied
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 20 more

With ls -la /usr/local/git/bin I have checked the ownership. git belonged to root, but I have changed it to jenkins.

Still this seems not enough, still get the permission error...

-rwxr-xr-x 1 jenkins wheel 5941024 Nov 8 2017 git

Update 2

The correct path in the Node's tools is /usr/local/git/bin/git. That was the problem.

user2366975
  • 4,350
  • 9
  • 47
  • 87
  • Have you tried the answers mentioned here? https://stackoverflow.com/questions/19887445/cannot-use-git-from-terminal – irowe Jun 10 '20 at 19:50
  • Also, how do you have git installed? If you want to use the system version you need to install the [XCode developer tools](https://developer.apple.com/library/archive/technotes/tn2339/_index.html), which is what the error on the top line seems to be saying. – irowe Jun 10 '20 at 19:52
  • I have installed git via the official installer from sourceforge. I do not want Xcode on my mac. The goal is to build all in docker containers on my mac. Jenkins does not start a docker container but tries to check out on mac host, but this is another question... – user2366975 Jun 10 '20 at 19:58
  • And I have tried the answers from your linked question. `/usr/local/git/bin:$PATH` did nothing. – user2366975 Jun 10 '20 at 19:59

1 Answers1

0

which git - is the command to find git location on mac

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129