You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Jenkins Windows代理节点Git检出任务失败问题求助

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.17 13:10:28