6

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?

nwalke
  • 3,170
  • 6
  • 35
  • 60

4 Answers4

2

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?

smooth reggae
  • 2,189
  • 13
  • 14
  • There are no other errors in the job, or the slave log. You say you suspect it can't find the `.ssh` folder where the keys would be, I assume that would be under the user's home directory. There is a `.ssh` folder, but no keys inside. This is the same as the master node as well. The private key I want to use is in the Jenkin's credential. – nwalke Mar 18 '15 at 05:52
  • I also don't think it's a file system permissions issue. The user Jenkins is running as has full control of the drive I'm trying to clone the repo to. – nwalke Mar 18 '15 at 06:02
  • Oh shoot. I restarted the service on the slave, now everything is happy. Rebooting fixes everything... sigh. – nwalke Mar 18 '15 at 06:05
  • 1
    I am glad it's working for you. It might be a good idea to review your setup now that it's working -- just so that you can build a checklist in case things stop working in the future :) – smooth reggae Mar 18 '15 at 06:21
1

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.

Ashoka
  • 41
  • 2
1

You might need to create and fill the ssh folder in the home folder of the windows service at C:\Windows\System32\config\systemprofile.

Source: https://www.techcoil.com/blog/home-directory-of-the-localsystem-account-in-windows-server-2012/

thi gg
  • 1,969
  • 2
  • 22
  • 47
0

I got same issue. The solution is adding below line to .ssh/config, it lets ssh support rsa again. The key no need to put to .ssh. Jenkins will handle the key from master side.

PubkeyAcceptedKeyTypes +ssh-rsa