gpt4 book ai didi

git - 如何调试 Cannot run program "C:\Program Files\Git"in a Jenkins job?

转载 作者:太空狗 更新时间:2023-10-29 13:20:11 24 4
gpt4 key购买 nike

我正在使用 jenkins 构建我的 git 项目,这是我在查看日志时遇到的错误。
我在 jenkins 中使用 git 插件。

您将如何排查该错误消息?

Started by user anonymous
Building in workspace E:\sw\jenkins\workspace\se12
ERROR: Workspace has a .git repository, but it appears to be corrupt.
hudson.plugins.git.GitException: Error performing command: git rev-parse --is-inside-work-tree

org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1180)
org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1150)
org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1146)
org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:962)
org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:972)
hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:651)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
Caused by: java.io.IOException: Cannot run program "C:\Program Files\Git" (in directory "E:\sw\jenkins\workspace\se12"): CreateProcess error=5, Access is denied
at java.lang.ProcessBuilder.start(Unknown Source)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1169)
... 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
Cloning the remote Git repository
Cloning repository $ git clone \\SE12\Adempiere370new\.git
Fetching upstream changes from $ git clone \\SE12\Adempiere370new\.git
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Error performing command: git fetch --tags --progress $ git clone \\SE12\Adempiere370new\.git +refs/heads/*:refs/remotes/origin/*
org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1180)
org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1043)
hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:651)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)

Caused by: java.io.IOException: Cannot run program "C:\Program Files\Git" (in directory "E:\sw\jenkins\workspace\se12"): CreateProcess error=5, Access is denied
org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1169)
... 14 more

最佳答案

也许你错误地设置了 git 可执行路径。

不应该是C:\Program Files\Git,而是C:\Program Files\Git\bin\git.exe
(这类似于 JENKINS-6181 )

The Git plugin page确实提到:

If you are seeing output indicating Git could not clone, something like the output below, go to to the Jenkins configuration settings (not the project settings, the global ones) and change the Git path to a fully qualified path (eg. not "git" but "/usr/bin/git" or wherever your Git binary is installed).

在您的情况下,检查 C:\Program Files\Git 确实是您的 Git 安装路径。

关于git - 如何调试 Cannot run program "C:\Program Files\Git"in a Jenkins job?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22005344/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com