Using Git with Jenkins

Written by: Harpreet Singh
3 min read


Jenkins is a continuous integration server and this means it needs to check out source code from a source code repository and build code. Jenkins has excellent support for various source code management systems like CVS, Subversion, etc. Git is fast becoming one of the most popular source code management systems. Jenkins works with Git through the Git plugin.

This blog shows how to use Git with Jenkins. The GitHub plugin should be used if GitHub is the Git server of choice (Using GitHub with Jenkins blog).  

We will look at a vanilla set up that is configured to build manually (instead of polling the repo or receiving pushes from the repo). 

Stable Release Version

The current stable release is version 1.1.15 and was released in Dec 2011. 

Requirement for Plug-in Use

There are not too many requirements for using this plugin:

  • Jenkins 1.398 or newer

  • A git repository to talk to ;-)

Step-by-Step Instructions on How to Use the Git Plugin


  1. Go to your Jenkins instance's root page.

  2. If your Jenkins instance has security enabled, login as a user who has the 

    Overall | Administer permission.

  3. Select the Manage Jenkins link on the left-hand side of the screen.

  4. Select the Configure Jenkins link, give the path to the Git executable on the system or let Jenkins install it automatically.

  5. Go to the the Manage Plugins link.

  6. On the Available tab, select the Git Plugin and click the Download and Install button at the bottom of the page.


  1. Go to your Jenkins instance job.

  2. Select the Configure link on the left hand side of the screen.

  3. In the Source Code Management field, enter the URL of the Git project which typically looks like:


This sets up your job to checkout all branches on the particular Git repository. 

If you have remote branches set up and you would like to build a particular remote branch, add the branch name into the Branches to build the textbox. 

The Advanced tab gives a number of options that can be configured on the build. For example: if there is a specific Git user name that should be used, populate the Config and Config values. 

Tips & Tricks 

This plugin can be used to implement a pre-commit feature wherein commits are merged into a stable branch only if builds happen successfully on a development branch. A subsequent blog will outline this advanced usage. 

Any Known Issues

  • There are plans to rewrite the plugin in the future to make the configuration easier. 

  • On Windows, additional steps are required to get the plugin working seamlessly. The steps are covered on the Jenkins Git plugin page.

Relevant Documentation

Harpreet Singh
Senior Director, Product Management

Learn more about managing and scaling Jenkins for the enterprise with this eBook.

Stay up to date

We'll never share your email address and you can opt out at any time, we promise.