Jenkins GitHub Integration: How to Install Git Plugin?

โšก Smart Summary

Jenkins GitHub Integration connects an automation server to a source repository so every commit can be built and verified automatically. Installing the Git plugin, creating a Freestyle job, authenticating with a token, and registering a webhook complete the connection.

  • ๐Ÿ”Œ Plugin Foundation: Jenkins ships with a minimal feature set, so third-party support arrives through plugins installed from the Manage Jenkins Plugins page.
  • ๐ŸŒฟ Git vs GitHub Plugin: The Git plugin supplies the Source Code Management option that clones a repository; the GitHub plugin adds webhook handling and commit status reporting.
  • ๐Ÿ’ป Local Git Required: Jenkins delegates cloning to the Git executable on the host, so a missing local installation produces the repository URL validation error.
  • ๐Ÿ”‘ Token Authentication: GitHub stopped accepting account passwords for Git operations in August 2021, so private repositories require a personal access token or an SSH key.
  • ๐Ÿช Automatic Triggering: A repository webhook pointing at the Jenkins github-webhook endpoint starts a build on every push instead of a manual run.
  • ๐Ÿงพ Verification: Running git –version confirms the executable resolves, and Manage Jenkins Tools records its path.
  • ๐Ÿ› ๏ธ Failure Recovery: Missing Source Code Management options, rejected credentials, and silent webhooks cause most integration failures.

Jenkins GitHub Integration

You have already learned what Jenkins is and how to install it on a Windows system. Assuming those basic steps are complete, we shall now move on to plugin management.

Jenkins has outstanding plugin support. Over a thousand third-party application plugins are available. To check whether Jenkins supports the third-party application you have in mind, search the plugins directory at https://plugins.jenkins.io/.

Jenkins GitHub Integration

Installation of Plugins in Jenkins

Jenkins comes with a fairly basic setup, so you need to install the required plugins to enable support for each third-party application.

GitHub is a web-based repository of code that plays a major role in DevOps. It provides a common platform for multiple developers working on the same code or project to upload and retrieve updated code, thereby facilitating continuous integration.

Jenkins needs the Git plugin installed before it can pull code from a GitHub repository. The two plugin names are often confused, so the table below separates them:

Plugin What it provides Required for this walkthrough?
Git plugin The Git option under Source Code Management, repository cloning, and branch selection Yes โ€” this is the essential one
GitHub plugin Webhook handling, the GitHub hook trigger option, and build status reported back to commits Only for automatic triggering

You need not install these plugins if you already accepted the suggested plugins during the Jenkins installation setup, since the Git plugin is part of that set. If not, here is how to install them and pull code from a GitHub repository.

How to Install Git Plugin in Jenkins

Following is a step by step process on how to install the Git plugin in Jenkins:

Step 1: Open your dashboard.
Click on the Manage Jenkins button on your Jenkins dashboard:

Install Git Plugin in Jenkins

Step 2: Find the plugins option.
Click on Plugins. On current Jenkins releases this entry is labelled simply Plugins; older releases labelled the same screen Manage Plugins.

Install Git Plugin in Jenkins

Step 3: On the Plugins page, open the Available plugins tab and then:

  1. Select the Git plugin
  2. Click Install without restart. The plugin takes a few moments to download, depending on your internet connection, and is installed automatically.
  3. You may instead choose Download now and install after restart, in which case the plugin is applied when Jenkins next starts.
  4. If the plugin is already present, it appears on the Installed tab and no update is offered.

Install Git Plugin in Jenkins

Step 4: Once the plugins have been installed, go to Manage Jenkins > Plugins > Installed. Your new plugins are listed among the rest.

Install Git Plugin in Jenkins

With the plugin in place, Jenkins can now be pointed at an actual repository.

How to Integrate Jenkins With GitHub

We shall now walk through the process of integrating Jenkins and GitHub on a Windows system:

Step 1) Create a new job in Jenkins. Open the Jenkins dashboard at your Jenkins URL, for example http://localhost:8080/, and click New Item:

Integrate Jenkins With GitHub

Step 2) Enter the item name, select the job type, and click OK. We shall create a Freestyle project as an example.

Integrate Jenkins With GitHub

Step 3) Once you click OK, the page redirects to the project configuration form. Enter the project information here:

Integrate Jenkins With GitHub

Step 4) You will see a Git option under Source Code Management if the Git plugin has been installed in Jenkins:

Integrate Jenkins With GitHub

Note: If the Git option does not appear, reinstall the plugin, restart Jenkins, and log in to the dashboard again. The Git option will then be visible as shown above.

Step 5) Enter the Git repository URL to pull the code from GitHub.

Integrate Jenkins With GitHub

Step 6) You might get an error message the first time you enter the repository URL. For example:

Integrate Jenkins With GitHub

This happens when Git is not installed on the machine running Jenkins. Jenkins does not bundle its own Git binary; the plugin calls the Git executable on the host. To install Git locally, go to https://git-scm.com/downloads.

Integrate Jenkins With GitHub

Download the appropriate Git installer for your Operating System โ€” in this case Windows โ€” and install it on the machine running Jenkins. Complete the onscreen instructions to finish the installation.

Integrate Jenkins With GitHub

Step 7) Jenkins can execute Git repositories once Git is installed on the machine. To confirm the installation, open a command prompt, type git, and press Enter. A list of Git options appears:

Integrate Jenkins With GitHub

:: Confirm the Git executable resolves and report its version
git --version

:: Expected output
git version 2.51.0.windows.1

:: Show the full path Jenkins should record in Global Tool Configuration
where git

This confirms that Git is installed on your system.

Note: If Git is already installed, add the git.exe path under Manage Jenkins > Tools (labelled Global Tool Configuration on older releases).

Step 8) With everything in place, add the Git URL into Jenkins again. No error message appears, which confirms the Jenkins Git integration:

Integrate Jenkins With GitHub

Git is now properly configured on your system. A public repository will clone at this point, but a private one still needs credentials, which is the next step.

How to Authenticate Jenkins With a GitHub Personal Access Token

GitHub stopped accepting account passwords for Git operations in August 2021. Supplying a username and password in Jenkins therefore fails against any private repository with an authentication error, even when the same credentials sign in to the GitHub website. A personal access token replaces the password, and Jenkins stores it in its own credentials store rather than in the job configuration.

Create the token in GitHub first:

  1. In GitHub, open Settings > Developer settings > Personal access tokens.
  2. Choose a fine-grained token where possible, because it can be scoped to a single repository, or a classic token if your organisation still requires one.
  3. Grant read access to repository contents. Add commit status write access only when you want Jenkins to report build results back onto commits.
  4. Set an expiry date and copy the token immediately โ€” GitHub displays it exactly once.

Then register the token inside Jenkins:

  1. Go to Manage Jenkins > Credentials > System > Global credentials and click Add Credentials.
  2. Select Username with password as the kind. Enter your GitHub username, and paste the token into the password field.
  3. Give the entry a clear ID such as github-pat so it is recognisable in job configuration screens.
  4. Return to the job, open Source Code Management > Git, and select the new credential from the Credentials dropdown.

The red validation error under the repository URL disappears once Jenkins can authenticate. Two practical notes are worth remembering. First, tokens expire; a job that has run reliably for months and suddenly fails on checkout is almost always an expired token rather than a broken repository. Second, an SSH key is a valid alternative โ€” add the private key as an SSH Username with private key credential and use the git@github.com:owner/repo.git URL form instead of the HTTPS form.

How to Trigger Jenkins Builds Automatically With a GitHub Webhook

The job created above still has to be started by hand, which defeats the purpose of continuous integration. A webhook closes that gap: GitHub sends an HTTP request to Jenkins on every push, and Jenkins starts the build immediately.

Jenkins must be reachable from GitHub for this to work. On a laptop running localhost:8080 it is not, so either host Jenkins on a public URL or expose it temporarily through a tunnelling service during testing.

  1. Install the GitHub plugin. Return to Manage Jenkins > Plugins > Available plugins and install GitHub. This adds the trigger option that the Git plugin alone does not provide.
  2. Enable the trigger on the job. Open the job configuration, scroll to Build Triggers, and tick GitHub hook trigger for GITScm polling.
  3. Add the webhook in GitHub. In the repository, open Settings > Webhooks > Add webhook.
  4. Set the payload URL to your Jenkins address followed by /github-webhook/. The trailing slash matters.
  5. Set the content type to application/json and choose Just the push event.
  6. Save and test. GitHub sends a ping immediately. A green tick under Recent Deliveries means Jenkins accepted it.
# Payload URL format for the GitHub webhook
https://jenkins.example.com/github-webhook/

# Content type
application/json

# Verify from the Jenkins host that the endpoint answers
curl -I https://jenkins.example.com/github-webhook/

Push a commit to confirm the loop is closed. The job should appear in the build queue within a few seconds without any manual action. If nothing happens, open the webhook in GitHub and read the Recent Deliveries response code: a 403 usually points at Jenkins security settings blocking anonymous access to the endpoint, while a timeout means GitHub cannot reach the Jenkins URL at all.

Once builds trigger automatically, the remaining friction is usually a handful of recurring errors.

Common Jenkins GitHub Integration Errors and Fixes

Nearly every failed integration falls into one of the categories below, and each has a distinct symptom that points straight at the cause.

  • No Git option under Source Code Management: the Git plugin is not installed or not loaded. Reinstall it from Manage Jenkins > Plugins, restart Jenkins, and reload the job configuration page.
  • โ€œFailed to connect to repositoryโ€ on a public URL: Git is missing from the Jenkins host. Install Git, then confirm with git --version and record the path under Manage Jenkins > Tools.
  • Authentication failed on a private repository: an account password is being used. Replace it with a personal access token as described above, or switch to an SSH key.
  • Builds never start after a push: either the GitHub hook trigger checkbox is unticked, or GitHub cannot reach the Jenkins URL. Check the webhook delivery log in the repository settings.
  • Wrong branch is built: the Branch Specifier still holds the default */master while the repository uses main. Update the specifier to match.
  • Checkout worked yesterday and fails today: the personal access token has reached its expiry date. Generate a replacement and update the stored credential.

Also Check: Best Jenkins Alternatives (Open Source & Paid) and the CI/CD pipeline walkthrough, which builds on the connection established here.

FAQs

Yes. The Git plugin clones from any Git host, so the Source Code Management steps are identical. Only the webhook configuration differs, and dedicated GitLab or Bitbucket plugins provide host-specific triggers and status reporting.

For anything beyond a demonstration, yes. A Jenkinsfile stores the pipeline definition in the repository itself, so build steps are versioned and reviewed alongside the code rather than living only in the Jenkins UI.

AI assistants summarize failed build logs, propose the likely offending commit, and draft pipeline steps from a repository structure. Review every suggestion before applying it, particularly anything touching credentials.

No. AI accelerates diagnosis and configuration authoring, but the orchestration, scheduling, and audit trail still require a build server. Treat AI as an assistant layered on top of Jenkins, not a replacement for it.

Yes. Poll SCM under Build Triggers checks the repository on a schedule using cron syntax. It works behind a firewall but wastes requests and delays builds, so prefer webhooks whenever Jenkins is reachable.

Summarize this post with: