Jenkins+Github Integration
1 min readNov 6, 2023
Hello! I’m going to share with you how to integrate Jenkins open source CI/CD software development automation tool with Source Code Management tool GitHub.
This integration allows Jenkins to pull your data files and codes from GitHub automatically after each commit and then trigget builds.
First, we will start by configuring our GitHub:
- Generate SSH Key on Jenkins Server
- GitHub — Add SSH Public Key to GitHub
- Jenkins — Create Credentials with SSH Private Key and github username
- Go to GitHub repository and click on “Settings”
- Click on “Webhooks”
- Then click on “Add webhook”
- In the “Payload URL” field, paste your Jenkins environment URL. At the end of this URL add /github-webhook/. In the “Content-type” choose “application/json” and you can leave the “Secret” field empty.
- In the “Which events would you like to trigger this webhook?” select “Let me select individual events.” Then, click “Pull Requests” and “Pushes”. These events will trigger your webhook. Do not forget to check on “Active” option and “Add webhook”
Next, we will configure our Jenkins server:
- Create a new freestyle project by clicking “New Item”, give it a name and click “OK”
- Configure your project by clicking on “Source Code Management”. There select “Git” and paste your GitHub repository URL (e.g.,
git@github.com:username/repository.git
). - Next configure “Build Triggers”. Select the “Github hook trigger for GITScm polling”.
- Click on “Save” button.
Following these steps will let you integrate your Jenkins with Github. You may check if it is working by commiting your code and checking your projects.