0

I have been using Jenkins for many years, but I have never needed more than one agent for my tasks. Just recently, I found the need to add another agent, which is not Linux but Windows. Now, this node has everything ready; Git is installed as well. However, when I run the Jenkins jobs, it gives an error.

[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)

The pipeline is very basic. look something like this

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://[email protected]/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" } } } } 

1 Answer 1

0

The issue arose on my Jenkins Windows slave due to Git not being recognized by the Jenkins Git Plugin before inheriting the environment. To address this, ensure that the slave's PATH includes the Git executable by navigating to the slave configuration, verifying the Tool Locations under Node Properties, and entering the complete path to the git executable, including git.exe.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.