Jenkins Windows代理节点Git检出任务失败问题求助
我用Jenkins好多年了,之前一直只用一个Linux代理节点就够了,最近因为需求新增了一台Windows代理节点。这台节点已经配置好了,Git也安装完成,但运行Jenkins任务时却报错了。
下面是任务执行时的错误输出:
[Pipeline] checkout
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
using credential bitbucket-creds
/usr/bin/git rev-parse --resolve-git-dir c:\jenkins\workspace\prod-init-qa-job.git # timeout=10
ERROR: Workspace has a .git repository, but it appears to be corrupt.
hudson.plugins.git.GitException: Error performing git command: /usr/bin/git rev-parse --resolve-git-dir c:\jenkins\workspace\prod-init-qa-job.git
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2858)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2762)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2757)
我的流水线脚本很简单,内容如下:
pipeline { agent { label 'win-agent1' } stages { stage('Execute QA Job') { steps { dir('ansible-code') { git branch: 'main', changelog: false, credentialsId: 'bitbucket-creds', poll: false, url: 'https://Admin@bitbucket.org/xys/ansible.git' } sh "ansible-playbook -i ansible-code/qa-ais-pipeline/inv.ini ansible-code/qa-ais-pipeline/init-qa-job.yaml" bat "python c:\\qa-code\\OldSmokeTest.py" } } } }
备注:内容来源于stack exchange,提问作者Yousuf

