My team migrated from TFS to Github a couple months ago and we have been using Jenkins for our continuous integration testing. We are using the Jenkins Git plugin to poll our git repository and git clone after any check-in. Up until this past week, we have using the username/password method of authentication and it has been working fine. We were using Jenkins jobs to first do a git clone of our the git repository containing all dependencies of the master branch and then cloning the master branch. This makes compilation a little troublesome because the directory where the dependencies project is clone must be in a certain location relative to the master project for the master compilation script to recognize it and build correctly.
To mitigate this issue, we have modified the build/compile script of the master branch of our project to do the git clone of our dependencies project itself so that we don't have to build two separate projects. The issue with this in order for the build/compile script to successful pull from our private git repository, we have to authenticate Jenkins using private SSH keys instead username/password. So yesterday I began configuring Jenkins git to use SSH keys, the process was a breeze on Linux but a little trickier on Windows. Since Jenkins runs as a service on Windows, getting Git to look in the correct location and use the correct id_rsa SSH key to do this was a bit of a hassle but after spending a couple hours on it, I was able to get Jenkins cloning master successfully using SSH credentials.
The next step in our Jenkins job, after cloning the master is to execute a Windows batch script which compiles the project using cmake. The cloning of the dependencies project occurs in a cmake script called through the Jenkins batch script. The issue I am running into now is when the camke script for calls git clone to clone the dependencies project, it fails to authenticate due to an SSH authentication (publickey) error. My best guess as to what is happening is that once the Jenkins git plugin has successfully cloned the project and the job proceeds to the batch command step, the SSH key is released from whatever SSH-agent Jenkins git uses, so when git clone is called in the cmake script the authentication failed since the SSH Agent is no longer running. I'm think the Jenkins SSH Agent plugin may solve this issue but I'm not 100% sure.
I have done a lot of googling about this issue and have tried basically everything I can find. This includes putting the .ssh directory in C:\Windows\System32\config\systemprofile directory which is apparently the default path for %HOME% for git. I have also tried setting the HOME variable with setx. I was just wondering if anyone else has run into a similar problem with Github and SSH on Windows and has any suggestions.