Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Git SSH keys on Windows slave

Tags:

git

jenkins

We currently have a Jenkins master on Windows, an ubuntu slave, and a Windows slave. I'm trying to set up git on the Windows slave. msysgit is installed, and I included the directory in the system path variable so that I can call "git.exe" or "git.cmd" anywhere.

In my Jenkins configuration, I have a credential with a private SSH key. This credential is for Jenkins to use with Git. This works on the master node and the linux slave. I did not put the private ssh key on either of those two servers, Jenkins handled it for me.

But the Windows slave, not so much. When I run a job on the windows slave, all I get is ERROR: Error cloning remote repo 'origin'.

How can I get the credential working on the Windows slave? Or, if you don't think that's the issue, what would be my next troubleshooting steps?

like image 834
nwalke Avatar asked Mar 17 '15 22:03

nwalke


2 Answers

If you seen any other messages after this error, could you update your question to include them?

Without seeing them, I can only suspect that git on your Windows slave cannot find the .ssh folder (this folder contains your keys).

Have you already looked at the notes on the Git Plugin page?

like image 166
smooth reggae Avatar answered Oct 24 '22 20:10

smooth reggae


Please use C:\Program Files\git\Cmd\git.exe as the git environment variable for the windows slave configuration in Jenkins.

1) Manage Jenkins 2) Manage Nodes 3) Select Windows slave -> go to configuration 4) Add Environment variables for GIT as above complete path.

Also, go to global security settings -> Enable Slave -> Master.

This should work.

Cheers, Ashoka.

like image 38
Ashoka Avatar answered Oct 24 '22 20:10

Ashoka