I had issues with getting Git up and running in a Hudson that was hosted as a Windows Service. The Git Commands would simply hang, the console output stopped at the line where the Git command was executed.

If I took the service down and started hudson from the command-line everything worked out great.

It turns out that when Hudson is started as a windows service there is no HOME environment variable set. And this is where Git finds the keys for SSH identification.

This adds the environment variable for the home directory when the service starts up. Now Git can fetch when I run Hudson as a service. Naturally you have to change the path to correspond to the location of the .shh/ directory to use. In our case there is a dedicated user running hudson.