GitHub on Jenkins
This tutorial will show you how to use your private GitHub repository on Jenkins.
The first thing that you will need to link GitHub with Jenkins is a SSH Public Key. You can generate it, or you can use the one generated automatically by CloudBees when you open your account. You can find the public component of this key-pair, by configuring a new or existing job, and choosing "Git" as your SCM.
Once it is done, you should use this public key into your GitHub account. All this process is detailed in the How to use Private GitHub Repositories with CloudBees.
Then, maybe you would like to have Continuous Deployment through the GitHub repository. In this case you have to install the GitHub plugin.
The GitHub plugin
In CloudBees you can use this plugin for free. You should do it in the standard way in which you install a plugin on Jenkins. It means, go to Manage Jenkins -> Manage Plugins -> Available [tab] and choose the github plugin, and finally click on the "Install Button" at the bottom of the page.
Then, you have to configure the “Source Code Management” on your Jenkins job.
The two options to manage the Commit Hooks
Once it is done, there are two options: use the GitHub plugin so as to manage the Commit Hooks or just configure the Manually Manage Hook URLs on GitHub. With this last option you will not need to enter your GitHub credentials. Both processes are described in our GitHub Commit Hooks HOWTO tutorial.
Manage the Commit Hooks from GitHub plugin on Jenkins
Go to the Jenkins Global configuration (https://.ci.cloudbees.com/configure) and just check “Let Jenkins auto-manage hook URLs”, fill the form with your GitHub credentials and check the box “Build when a change is pushed to GitHub” on your Jenkins job.
Manually Manage Hook URLs on GitHub
For this case, you only need to go to your repository on GitHub and then click on the Setting button. Then choose "Service Hooks" -> "Post-Receive URLs" and enter the url to your Jenkins instance's GitHub WebHook, which is "https://.ci.cloudbees.com/github-webhook/".
Finally, you will need to check the box “Build when a change is pushed to GitHub”on your Jenkins job as well.
Stay up to date
We'll never share your email address and you can opt out at any time, we promise.