问答详情
源自:5-2 创建Jenkins自动化部署任务

构建报错:The recommended git tool is: NONE

Started by user rootRunning as SYSTEM
Building remotely on TestEnv in workspace /root/.jenkins/workspace/DeployOrder
The recommended git tool is: NONE
using credential 6d01249a-9773-4e97-b40b-5bab042e231c
 >  /usr/local/bin/git rev-parse --resolve-git-dir /root/.jenkins/workspace/DeployOrder/order/.git # timeout=10
ERROR: Workspace has a .git repository, but it appears to be corrupt.
hudson.plugins.git.GitException: Error performing git command:  /usr/local/bin/git rev-parse --resolve-git-dir /root/.jenkins/workspace/DeployOrder/order/.git
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2679)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2601)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2597)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1968)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1980)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.hasGitRepo(CliGitAPIImpl.java:395)
	at hudson.plugins.git.GitAPI.hasGitRepo(GitAPI.java:241)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:924)
	at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(Remo

我做了哪些排查


http://img4.mukewang.com/625d60970001915311200566.jpg

git 公钥和私钥配置是OK的


http://img4.mukewang.com/625d60eb0001d90311960566.jpg


【我做了哪些尝试】 

    我按照这篇博客 https://www.cnblogs.com/panda-123/p/14456428.html 操作改成 main 不行


    

  我按照  https://stackoverflow.com/questions/8639501/jenkins-could-not-run-git 这篇提问中解决办法尝试


    http://img4.mukewang.com/625d61530001222220381084.jpg

这是我本地配置


http://img4.mukewang.com/625d629c0001a65021020738.jpg


这是我TestEnv 环境的


http://img4.mukewang.com/625d624d00011b7d11940212.jpg



这是我本地Mac

http://img1.mukewang.com/625d62d80001df2408160294.jpg



提问者:程序员熊明才 2022-04-18 21:09

个回答

  • 慕仙4027102
    2023-08-14 12:03:04

    解决方案:你需要配置Git在服务器上的运行地址

    具体可参考https://blog.csdn.net/weixin_40816738/article/details/90280863