Resources‎ > ‎

Jenkins Continuous Integration

Setting up Jenkins for Windows with GIT and SSH is a tricky thing. This is because there are multiple binaries for ssh, git, ssh-keygen, plink, windows users, different .ssh directories, differences in directory handling/paths (I'm looking at you "Program Files (x86)"!)  etc.

This is intended for a slave machine that can be used to build and test Visual studio projects, such as MFC applications. This can reveal the problems which can be reported back as development changes are put into place for other front end implementations (GNU/Linux OSX even WebGL etc.)

msysgit contains a full environment to build GIT ( I have not tried ). This also contains other unix utils
GIT is a precompiled binary for the system ( I use this )
cygwin + git is a treacherous path that msysgit has solved. Avoid this. Be sure that the git, ssh, plink binaries from any such installations are not in the system PATH

First step: GIT + SSH

Install PuTTYin C:\PuTTY (use windows installer to install everything)

Install GIT in C:\Git and use plink.exe from PuTTY

Adding to known_hosts
Open a command window in C:\Users\<username>\
"C:\Git\bin\ssh.exe" -T <projectuser>
ls - to check that you are logged in (no PS1 on term)

Test login again, so you don't have any prompt for new server
"C:\Git\bin\ssh.exe" -T <projectuser>

Creating and setting up the ssh keys for automatic login
"C:\Git\bin\ssh-keygen.exe" -t dsa

Note: Do not use a passphrase, allow default folder of C:\Users\<username>\.ssh

network copy the public key from C:\Users\<username>\.ssh\ to
cat >> authorized_keys
remove that key now (rm

Test the auto login, to make sure you don't have to enter password
"C:\Git\bin\ssh.exe" -T <projectuser>

Enable ssh login for the system account (Windows 7 x64)
Copy folder .ssh for system account on 64 bit system
C:\Users\<username>\.ssh to C:\Windows\SysWOW64\config\systemprofile\.ssh 

By default, the Jenkins installer sets up Jenkins to run as a service, which runs as the “Local System account”, NOT your user account. IF the “Local System account” does not have SSH keys or known_hosts set up, “git clone” will fail.

Testing the system account and GIT access can be done using PS tools ( (see guide website)

Second step: Jenkins

Install the Jenkins native package for windows (Note you will need latest Java runtime)
Visit http://localhost:8080 in a web browser
Install the Git plugin
  • Go to “Manage Jenkins” –> “Manage Plugins” –> “Available”
  • Check the box next to “Git Plugin”
  • Click “Download now and install after restart”
  • After the message “Downloaded Successfully…” check the box “Restart Jenkins…”
  • Click the link “ENABLE AUTO REFRESH” in the top right of the page
  • Now we need to configure Jenkins to know where the git cmd is located.
  • Go to “Manage Jenkins” –> “Configure System”
  • Under “git” change “Path to Git executable” to C:\Git\cmd\git.exe (NOT C:\Git\bin\git.exe)
  • Click the “Save” button

SSH credential should be setup
  • Go to "Credentials" -> "Global Credentials"
  • Click on the default user there (null) -> "Update"
  • give a meaningful username (I use the <projectuser>
  • Private Key -> "From a file on Jenkins master"
    • C:\Users\<username>\Documents\.ssh\id_dsa
  • Click on the "Save" button

Admin setup
    Jenkins URL: use public address e.g.
    System admin email:
    SMTP server:

Third step: Setting up the a new Jenkins job

1) Source code management -> Git
e.g. use the repos e.g. WOGL:
  • ssh://<projectuser>
  • Select the Credentials created ealier <projectuser>
2) Click on Build Now

3) You can click on the status and the Build Console to view progress. 

4) Be patient, even for small projects, the output will not show anything and will take a while. The first sign of success is seeing a .git folder e.g. C:\jenkins\workspace\wogl\.git

Building in workspace C:\jenkins\workspace\wogl
Cloning the remote Git repository
Cloning repository ssh://
git --version
git version 1.8.4.msysgit.0
(stalls around here...)
Checking out Revision dcba94df4ab10735fe1bff4d1381acc192da0ee1 (origin/master)
First time build. Skipping changelog.
Finished: SUCCESS

Fourth step: Building the project

We are using Microsoft Visual Studio 2010, but Jenkins will use any means of command line parameters to start a build process.

1) Click "Add Build Step" -> "Execute windows batch command"
2) Add the custom build script. The last command will return the status
wogl example:
    call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
    msbuild "C:\jenkins\workspace\wogl\windows\wogl\wogl\wogl.vcxproj"

Explanation: using the path to MSVS, setup the environment to use the developer tool "msbuild", then run msbuild on the project given it's full path as a .vcxproj file

3) Click "Save"

4) Build Now (cross fingers)

Failed to build

This is where the settings of the project come into play, comparing the environment of the IDE, with the cmd set environment that Jenkins uses.

Cannot open include file:
If you have set relative directories based on the solution directory i.e $(SolutionDir) then you might have to fiddle around. Check the build console to see the errors, and diagnose the issue by using a separate command window after modifying the project settings. It is easier to to change all these settings on another machine that has already been setup for development with git and can commit + push.  This is because user/email config not setup on the Jenkins one, unless you go the PS tools path.

Fifth step: Testing

This is entirely up to you. You can add another project that does certain tests, or append a tests script (batch file) to the build step so it is all the same process. 

e.g. wogl
New Job ->  wogl tests

Build after other projects are built
: select wogl

Execute Windows batch command
echo "blah" > C:\Users\<username>\Documents\test.txt

Build now


More information

Guide references: could not follow this to the letter, but more information from here