Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

git - ERROR: Error cloning remote repo 'origin'

Tried with the configure option, not able to find the tools configuration option and the git executable section. Seems like it occurs after a successful build only. Please help.

Here's the output I receive after building the project on the console output section:

  Building in workspace C:UsersAnishas.jenkinsworkspaceSample123
    Cloning the remote Git repository
    Cloning repository https://github.com/AnishaSalunkhe/HelloWorld.git
     > C:UsersAnishasgit init C:UsersAnishas.jenkinsworkspaceSample123 # timeout=10
    ERROR: Error cloning remote repo 'origin'
    hudson.plugins.git.GitException: Could not init C:UsersAnishas.jenkinsworkspaceSample123
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:656)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:463)
        at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1057)
        at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097)
        at hudson.scm.SCM.checkout(SCM.java:485)
        at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
        at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
        at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
        at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
        at hudson.model.Run.execute(Run.java:1738)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
        at hudson.model.ResourceController.execute(ResourceController.java:98)
        at hudson.model.Executor.run(Executor.java:410)
    Caused by: hudson.plugins.git.GitException: Error performing command: C:UsersAnishasgit init C:UsersAnishas.jenkinsworkspaceSample123
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1726)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1695)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1691)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1321)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:654)
        ... 12 more
    Caused by: java.io.IOException: Cannot run program "C:UsersAnishasgit" (in directory "C:UsersAnishas.jenkinsworkspaceSample123"): CreateProcess error=5, Access is denied
        at java.lang.ProcessBuilder.start(Unknown Source)
        at hudson.Proc$LocalProc.<init>(Proc.java:240)
        at hudson.Proc$LocalProc.<init>(Proc.java:212)
        at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
        at hudson.Launcher$ProcStarter.start(Launcher.java:381)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1715)
        ... 16 more
    Caused by: java.io.IOException: CreateProcess error=5, Access is denied
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(Unknown Source)
        at java.lang.ProcessImpl.start(Unknown Source)
        ... 22 more
    ERROR: null
    Finished: FAILURE
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This wasted so much time on my Jenkins Windows slave.

I knew git was in the path because I executed "where git" in the build job's batch command.

where git
C:Program Files (x86)Gitcmdgit.exe

Apparently the Jenkins Git Plugin executes ** before ** the environment is inherited.

SET YOUR SLAVE's PATH to Git ( Just DO IT !! )

1) Go to your Windows slave configuration Manage Jenkins > Manage Nodes

2) Select your slave configuration

3) Check Tool Locations under Node Properties

4) Enter complete path to git executable including git.exe

[x] Tool Locations
   Name: (GIT) git
   Home: C:Program Files (x86)Gitcmdgit.exe

See screenshot:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...