Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 91 Next »

Plugin Information

View GitHub on the plugin site for more information.

Older versions of this plugin may not be safe to use. Please review the following warnings before using an older version:

Github Plugin

This plugin integrates Jenkins with Github projects.

The plugin currently has three major functionalities:

  • Create hyperlinks between your Jenkins projects and GitHub
  • Trigger a job when you push to the repository by groking HTTP POSTs from post-receive hook and optionally auto-managing the hook setup.
  • Report build status result back to github as Commit Status (documented on SO)
  • Base features for other plugins

Hyperlinks between changes

The Github plugin decorates Jenkins "Changes" pages to create links to your Github commit and issue pages. It adds a sidebar link that links back to the Github project page.

When creating a job, specify that is connects to git. Under "Github project", put in: git@github.com:Person/Project.git Under "Source Code Management" select Git, and put in git@github.com:Person/Project.git

Trigger a build when a change is pushed to GitHub

This feature enables builds after post-receive hooks in your GitHub repositories. This trigger only kicks git-plugin internal polling algo for every incoming event against matched repo.

To be able to use this feature:

Manual Mode

In this mode, you'll be responsible for registering the hook URLs to GitHub. Click the (question) icon to see the URL in Jenkins that receives the post-commit POSTs. Just go to Step 3.

Automatic Mode (Jenkins manages hooks for jobs by itself)

In this mode, Jenkins will automatically add/remove hook URLs to GitHub based on the project configuration in the background. You'll specify GitHub OAuth token so that Jenkins can login as you to do this.

Step 1. Go to the global configuration and add GitHub Server Config.

Step 2.1. Create your personal access token in GitHub.

Plugin can help you to do it with all required scopes. Go to Advanced -> Manage Additional GitHub Actions -> Convert Login and Password to token

Two-Factor Authentication

Auto-creating token doesn't work with GitHub 2FA

You can create "Secret text" credentials with token in corresponding domain with login and password directly, or from username and password credentials.

Step 2.2. Select previously created "Secret Text" credentials with GitHub OAuth token.

Required scopes for token

To be able manage hooks your token should have admin:org_hook scope.

GitHub Enterprise

You can also redefine GitHub url by clicking on Custom GitHub API URL checkbox.
Note that credentials are filtered by entered GH url with help of domain requirements. So you can create credentials in different domains and see only credentials that matched by predefined domains.

Step 3. Once that configuration is done, go to the project config of each job you want triggered automatically and simply check "Build when a change is pushed to GitHub" under "Build Triggers". With this, every new push to the repository automatically triggers a new build.

Note that there's only one URL and it receives all post-receive POSTs for all your repositories. The server side of this URL is smart enough to figure out which projects need to be triggered, based on the submission.

Security Implications

This plugin requires that you have an HTTP URL reachable from GitHub, which means it's reachable from the whole internet. So it is implemented carefully with the possible malicious fake post-receive POSTS in mind. To cope with this, upon receiving a POST, Jenkins will talk to GitHub to ensure the push was actually made.

Jenkins inside a firewall

In case your Jenkins run inside the firewall and not directly reachable from the internet, this plugin lets you specify an arbitrary endpoint URL as an override in the automatic mode. The plugin will assume that you've set up reverse proxy or some other means so that the POST from GitHub will be routed to the Jenkins.

Trouble-shooting hooks

If you set this up but build aren't triggered, check the following things:

  • Click the "admin" button on the GitHub repository in question and make sure post-receive hooks are there.
    • If it's not there, make sure you have proper credential set in the Jenkins system config page.
  • Also, enable logging for the class names
    • com.cloudbees.jenkins.GitHubPushTrigger
    • org.jenkinsci.plugins.github.webhook.WebhookManager
    • com.cloudbees.jenkins.GitHubWebHook
      and you'll see the log of Jenkins trying to install a post-receive hook.
  • Click "Test hook" button from the GitHub UI and see if Jenkins receive a payload.

Using cache to GitHub requests

Each GitHub Server Config creates own GitHub client to interact with api. By default it uses cache (with 20MB limit) to speedup process of fetching data and reduce rate-limit consuming. You can change cache limit value in "Advanced" section of this config item. If you set 0, then this feature will be disabled for this (and only this) config.

Additional info:

  • This plugin now serves only hooks from github as main feature. Then it starts using git-plugin to fetch sources.
  • It works both public and Enterprise GitHub
  • Plugin have some limitations

Possible Issues between Jenkins and GitHub


  • In windows, Jenkins will use the the SSH key of the user it is running as, which is located in the %USERPROFILE%\.ssh folder ( on XP, that would be C:\Documents and Settings\USERNAME\.ssh, and on 7 it would be C:\Users\USERNAME\.ssh). Therefore, you need to force Jenkins to run as the user that has the SSH key configured. To do that, right click on My Computer, and hit "Manage". Click on "Services". Go to Jenkins, right click, and select  "Properties". Under the "Log On" tab, choose the user Jenkins will run as, and put in the username and password (it requires one). Then restart the Jenkins service by right clicking on Jenkins (in the services window), and hit "Restart".
  • Jenkins does not support passphrases for SSH keys. Therefore, if you set one while running the initial Github configuration, rerun it and don't set one.

Change Log

Version 1.19.0 (May 2, 2016)
  • (plus) Add new universal publisher for settings status. Can be extended with another plugins (see javadocs). Other steps now use it internally (pull #119)
  • (info) Improve logging for trigger
Version 1.18.2 (Apr 10, 2016)
  • (info) Use new plugin-parent pom
  • (error) Don't let the build fail if the commit doesn't exist in upstream (JENKINS-33371)
Version 1.18.1 (+ 1.18.0) (Mar 18, 2016)
  • (info) Simplify some UI, texts and misc to be more common plugin (JENKINS-33228)
  • (error) Fix stored XSS in github link action. Now it allows only urls that matches scheme + fqdn + path
Version 1.17.1 (Feb 22, 2016)
  • (plus) Handle ssh:// URLs that doesn't contain git@ (pull #110)
Version 1.17.0 (Jan 26, 2016)
  • (plus) Administrative monitor, that can tell about hooks registering problem (also with warning in job config) (JENKINS-24690)
Version 1.16.0 (Jan 14, 2016)
  • (plus) Show the "GitHub" link for Workflow projects (pull #105)
Version 1.15.0 (Jan 7, 2016)
  • (plus) Allow Commit Notifications to be used as Workflow Build Steps (pull #102)
Version 1.14.2 (Dec 21, 2015)
  • (error) Fix NPE after deserialization of old configs for status steps (JENKINS-32132)
Version 1.14.1 (Dec 15, 2015)
  • (plus) Configurable build context and message in status builder and notifier (JENKINS-27154)
  • (plus) Let GitHub Project property be applied to any Job (even workflow)
  • (error) Ignore files when clean root cache dir (in 1.14.0 it throws IOException in such case)
  • (info) Useful method GitHubRepositoryName#create to create it from GitHubProjectProperty
Version 1.14.0 (Oct 7, 2015)
  • (plus) Workflow support (JENKINS-27136)
  • (error) Handle pings from organization webhooks (JENKINS-30626)
  • (info) Using okHttp as client to make requests to GH instead of built-in URLConnection
  • (plus) Add cache to all requests to GitHub. It limited to 20MB for each GitHub server by default. Set 0 to disable this feature in "Advanced" section of GitHub Server configuration.
  • (info) Now plugin requires java 1.7
Version 1.13.3 (Sep 2, 2015)
  • (error) Restore old credential class to save backward-compatibility with plugins uses GH credentials (JENKINS-30223)
Version 1.13.2 (Aug 31, 2015)
  • (error) Ignore malformed Jenkins URL if override hook url
Version 1.13.1 (Aug 31, 2015)
  • (info) Clarify error log message when plugin not configured (JENKINS-30207)
Version 1.13.0 (Aug 24, 2015)
  • (plus) Credentials usage instead of plain token in global configuration. It requires plain-credentials-plugin to create "Secret text" credentials with token to use.
  • (info) Change UI in global configuration
  • (info) Move all global configuration from descriptor to separate class.
Version 1.12.1 (Aug 10, 2015)
  • Fix NPE in stop method of GHPushTrigger on 1.621 jenkins
  • Fix dummy "Unknown content type null" in logs
Version 1.12.0 (Jul 22, 2015)
  • Migrate to webhooks (fixes ability to use multiple jenkins instance with one repository)
  • Provide extension points for subscribing/listening hooks
Version 1.11.3 (Apr 13, 2015)
  • Bumped up to newer GitHub API library to deal with incompatible API changes in that library.
Version 1.11.2 (Feb 25, 2015)
  • (info) Added "re-register" button in global page for re-registering hooks (JENKINS-25127)
Version 1.11.1 (Mar 26, 2015)
Version 1.11 (Feb 25, 2015)
  • (info) Refer builds in commit status context (JENKINS-23995)
  • (info) Upgrade github-api-plugin dependency to 1.59
Version 1.10 (Nov 17, 2014)
  • (plus) Build step to set Github commit status as "pending"
  • (error) Prevent NPE in GitHubCommitNotifier if Git checkout fails (JENKINS-23641)
  • (error) Fixed NoClassDefFoundError when Multiple SCMs Plugin is not present
  • (info) Make the build status configurable if GitHubCommitNotifier fails (JENKINS-25312)
  • (info) Improved error checks in the global configuration page.
  • (info) Resolve variables in GitHub repository URL
Version 1.9.1 (Jul 16, 2014)
  • Fixed "Github Webhook event of type null is not supported" (JENKINS-23661)
Version 1.9 (Jul 1, 2014)
  • Webhook auto management now works with GitHub Enterprise (JENKINS-18710)
  • GitHub Web Hook does not work unless "Prevent Cross Site Request Forgery exploits" is disabled (JENKINS-20140)
Version 1.8
Version 1.7 (Jul 7, 2013)
  • Add the name of the user who pushed to Github into the log (pull #17).
  • Recognize GitHub repository URLs that doesn't end with ".git"
  • Got rid of API token and added OAuth token for interacting with GitHub.
  • Webhook support is no longer a pre-requisite for commit status notification (JENKINS-18165)
Version 1.4 (Jun 13, 2012)
  • Removed GitHub V2 API dependency
Version 1.3 (May 31, 2012)
  • Improved to use the new Jenkins hook type available in GitHub
  • Change GitHubPushCause to extend from SCMTriggerCause (pull #15).
Version 1.2 (Mar 13, 2012)
  • Refactored to enable GitHub SQS plugin (pull #13).
Version 1.1 (Feb 11, 2012)
  • URL normalisation corrupts urls where the project name legitimately ends in 'tree/' (pull #10).
  • Global configuration not saved since Jenkins 1.445 (JENKINS-12487).
  • Also trigger jobs with GitHub repositories configured via MultipleSCMs plugin (pull #12).
  • Match git http:// urls which don't container a username@host since these are valid.
Version 1.0 (Jan 11, 2012)
  • the post-receive hook handling was not poking read-protected projects.
Version 0.9 (Jan 4, 2012)
  • Fixed a bug in handling organization's private repository pull #4
  • Updated to use a newer version of the github-api library.
Version 0.7 (Aug 27, 2011)
  • Supported ssh-based access to GitHub. pull #4
  • Fixed a bug in GitHub repository pattern matching that didn't allow "." in the name pull #3
Version 0.6 (Jul 21, 2011)
  • Added JGit explicitly to improve interaction with the Git plugin
Version 0.5 (Jun 10, 2011)
  • Added support for post-receive trigger
Version 0.4 (Feb 14, 2011)
  • Remove unused code
Version 0.2 (Jun 25, 2009)

Open Issues

T Key Summary Status Updated Created

  • No labels