Maven release builds with Jenkins and Git

We have a Jenkins continuous integration server that among other things allows us to run Maven release builds centrally using the M2 release plugin for Jenkins.

This setup worked fine with Subversion, but needed some tweaking after our recent switch to Git and github:enterprise. Here’s what I did to make it work:

  • The release plugin needs write access to the upstream repository, so I had to configure Jenkins to use an ssh key associated with a real account instead of a deploy key that only gives read access.
  • To tie the release commits to the Jenkins server, I configured the global “” and “” settings of the Jenkins account to “Jenkins” and “jenkins@…”.
  • Finally, I hit an “”ref HEAD is not a symbolic ref” error caused by Jenkins by default using a detached HEAD. A quick web search uncovered a solution as described by Stephen Connolly in a related CloudBees user forum thread. The solution was to set the “Checkout/merge to local branch (optional)” option under advanced Git settings on the Jenkins build configuration screen.

With that setup in place, we can again cut new releases with just a single click of the “Schedule Maven Release Build” button. Nice!

2 Responses to Maven release builds with Jenkins and Git

  1. Lily Ju says:

    Hi Jukka,

    How did you make Jenkins work with Git in the first place? I have trouble to make this work. I have my ssh in my Windows account home, I can use git command in CMD without any problem. But when I build it, I get:

    Process leaked file descriptors. See… for more information ERROR: Failed to clean the workspace

    My goal is what you can do, click Schedule Maven Release Build.

    Thank you so much,


  2. Configuring Jenkins with Git on Windows is a bit tricky. See for some troubleshooting tips.