git 错误:克隆远程 repo 'origin' 时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24608802/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:16:37  来源:igfitidea点击:

ERROR: Error cloning remote repo 'origin'

gitjenkins

提问by user3812054

I am trying to configure a Git project in Jenkins using the Git plugin.

我正在尝试使用 Git 插件在 Jenkins 中配置一个 Git 项目。

In the 'Manage Jenkins' page I enter repository URL in the Git configuration.

在“管理 Jenkins”页面中,我在 Git 配置中输入存储库 URL。

However when I'm building the project I get the following error:

但是,当我构建项目时,出现以下错误:

ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init C:\Users\m.kothamasu\.jenkins\jobs\gvp web\workspace
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:476)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:379)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:846)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:879)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1252)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:624)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:530)
    at hudson.model.Run.execute(Run.java:1732)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:234)

Caused by: hudson.plugins.git.GitException: Error performing command: C:\Users\m.kothamasu\GIT init C:\Users\m.kothamasu\.jenkins\jobs\gvp web\workspace
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1332)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1301)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1297)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1084)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:474)
    ... 11 more
Caused by: java.io.IOException: Cannot run program "C:\Users\m.kothamasu\GIT" (in directory "C:\Users\m.kothamasu\.jenkins\jobs\gvp web\workspace"): CreateProcess error=5, Access is denied
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
    at hudson.Proc$LocalProc.<init>(Proc.java:244)
    at hudson.Proc$LocalProc.<init>(Proc.java:216)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:780)
    at hudson.Launcher$ProcStarter.start(Launcher.java:360)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1321)
    ... 15 more
Caused by: java.io.IOException: CreateProcess error=5, Access is denied
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
    at java.lang.ProcessImpl.start(ProcessImpl.java:30)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
    ... 20 more

回答by VonC

Check that you did specify the git executablein your Jenkins Git plugin configuration:

检查您是否在 Jenkins Git 插件配置中指定了 git可执行文件

C:\Users\m.kothamasu\GIdoesn't look like an exe.

C:\Users\m.kothamasu\GI看起来不像一个exe。

That would be similar to JENKINS-6181(which was about perforce, but the idea remains the same).

这将类似于JENKINS-6181(这是关于 perforce,但想法保持不变)。

Check also JENKINS-12353, to make sure <git/bin>is in your PATH.

还要检查JENKINS-12353,以确保<git/bin>在您的路径中。

回答by Shark644

you can set Git location in Jenkins server/node configuration:

您可以在 Jenkins 服务器/节点配置中设置 Git 位置:

goto Configure, under section Node Properties mark checkbox Tools Location and set yours path to Git.

转到配置,在节点属性部分下标记复选框工具位置并将您的路径设置为 Git。