By Shivam Singh, founder of TesterRank · Updated September 2026
Jenkins and Git are best friends. Every pipeline starts with pulling code from Git. But there is more to it than just entering a URL. You need to configure credentials, branch strategies, and PR builds. Let us set it up properly.
Never use your GitHub password. GitHub deprecated password authentication in 2021. Go to GitHub > Settings > Developer settings > Personal Access Tokens > Generate new token. Give it "repo" scope. Use this token as the password in Jenkins.
SCM means source code management, usually Git. This step tells Jenkins which repository and branch to download before running tests.
pipeline {
agent any
stages {
stage('Checkout') {
steps {
// Option 1: Simple — uses the repo configured in job settings
checkout scm
// Option 2: Explicit — checkout a specific repo and branch
git branch: 'main',
credentialsId: 'github-creds',
url: 'https://github.com/yourorg/automation-tests.git'
}
}
}
}A regular Pipeline job builds one branch. But what if developers create feature branches and PRs? You do not want to create a separate job for each branch. Multibranch Pipeline solves this. It automatically discovers branches and PRs and runs the Jenkinsfile from each.
Now when a developer opens a PR, Jenkins automatically runs the Selenium suite against that PR branch. The test results show up as a status check on the PR in GitHub. Green checkmark = tests passed. Red X = tests failed. The reviewer can see test results before merging.
In interviews, mention Multibranch Pipeline. It shows you understand branch-level CI. Say: "We use Multibranch Pipeline so every PR automatically runs the smoke suite. Tests must pass before the code can be merged." This is a mature CI setup.
Q: How do you integrate Jenkins with GitHub?
A: We use Multibranch Pipeline with GitHub integration. I configure GitHub credentials using a Personal Access Token stored in Jenkins Credentials. The Multibranch Pipeline auto-discovers branches and PRs and runs the Jenkinsfile from each branch. GitHub webhooks trigger builds instantly on push. Test results are reported back to GitHub as status checks — green checkmark on the PR if tests pass, red X if they fail. This ensures no code merges without passing the smoke suite. For the main branch, we run full regression nightly via cron.
Key Point: Use Personal Access Tokens for GitHub credentials. Multibranch Pipeline auto-builds every PR and reports status back to GitHub.