[JENKINS-45120] GitHub plugin doesn't automatically add webhooks on GitHub for a Pipeline job
WORKAROUND After creating a job, make a build, then Manage Jenkins > Configure System > GitHub > Advanced > Re-register hooks for all jobs.
Steps to reproduce:
1. Generate personal access token on GitHub with repo and admin:repo_hook scopes.
2. Add "Secret text" credentials with the token from the previous step.
3. In Manage Jenkins > Configure System add GitHub server with credentials from the previous step.
4. Create Pipeline job.
4.1. Check "GitHub project" and specify a repository URL.
4.2. Check "GitHub hook trigger for GITScm polling."
4.3. Click "Save."
In System Log I see:
GitHub webhooks activated for job p1 with [] (events: [PUSH])
When I create Freestyle Project with repository URL and credentials specified on Source Code Management tab and "GitHub hook trigger for GITScm polling" checked, I see:
GitHub webhooks activated for job fsp1 with [GitHubRepositoryName[host=github.com,username=user,repository=repo]] (events: [PUSH])
PING webhook received from repo //github.com/user/repo]>!
I must admit that even for Freestyle project just checking "GitHub project" and specifying repository URL doesn't cut it. Which is strange. Isn't that enough info to create a webhook?
—
UPD I was about to report it again, but found this issue. So let me report again after all.
Environment: Jenkins 2.277, Docker version 18.06.3-ce build d7080c1, Debian GNU/Linux 8, GitHub API Plugin 1.122, GitHub plugin 1.32.0.
Steps to reproduce:
# docker-compose.yml
version: '3'
services:
jenkins:
image: jenkins/jenkins:2.277
ports:
- 8080:8080
$ docker-compose up
- Unlock Jenkins
- Install suggested plugins
- Create a user
- https://github.com/settings/tokens
- Generate new token
- Scopes: repo, admin:repo_hook
- Generate token
- Manage Jenkins > Manage Credentials > (Jenkins/global) > Add credentials
- Kind: Secret text
- Scope: System
- Secret: (the token)
- OK
- Manage Jenkins > Manage Credentials > (Jenkins/global) Add credentials
- Kind: Username with password
- Scope: Global
- Username: (email)
- Password: (password)
- Manage Jenkins > Configure System > GitHub > Add GitHub Server > GitHub Server
- Choose the token credentials
- Test connection (succeeds)
- Check Manage hooks
- Save
- Create a public repository on GitHub with the following Jenkinsfile in the master branch:
pipeline { agent any stages { stage('Stage 1') { steps { sh 'echo $GIT_COMMIT' } } } }
<li>New Item
<ul>
<li>Enter an item name</li>
<li>Pipeline</li>
<li>OK</li>
<li>Check GitHub project</li>
<li>Enter the URL: <a href="https://github.com/USER/REPO" class="external-link" target="_blank" rel="nofollow noopener">https://github.com/USER/REPO</a></li>
<li>Check GitHub hook trigger for GITScm polling</li>
<li>Pipeline: Pipeline from SCM</li>
<li>SCM: Git</li>
<li>Repository URL: <a href="https://github.com/USER/REPO" class="external-link" target="_blank" rel="nofollow noopener">https://github.com/USER/REPO</a></li>
<li>Credentials: (credentials)</li>
<li>Branch specifier: <tt>*/master</tt> (the default)</li>
<li>Save</li>
</ul>
</li>
<li><a href="https://github.com/USER/REPO/settings/hooks" class="external-link" target="_blank" rel="nofollow noopener">https://github.com/USER/REPO/settings/hooks</a></li>
No new hooks.
Originally reported by
xyuri, imported from: GitHub plugin doesn't automatically add webhooks on GitHub for a Pipeline job
- assignee:
lanwen
- status: Open
- priority: Minor
- component(s): github-plugin
- resolution: Unresolved
- votes: 10
- watchers: 13
- imported: 2025-12-08
Raw content of original issue
WORKAROUND After creating a job, make a build, then Manage Jenkins > Configure System > GitHub > Advanced > Re-register hooks for all jobs.
Steps to reproduce:
1. Generate personal access token on GitHub with repo and admin:repo_hook scopes. 2. Add "Secret text" credentials with the token from the previous step. 3. In Manage Jenkins > Configure System add GitHub server with credentials from the previous step. 4. Create Pipeline job. 4.1. Check "GitHub project" and specify a repository URL. 4.2. Check "GitHub hook trigger for GITScm polling." 4.3. Click "Save."
In System Log I see:
GitHub webhooks activated for job p1 with [] (events: [PUSH])When I create Freestyle Project with repository URL and credentials specified on Source Code Management tab and "GitHub hook trigger for GITScm polling" checked, I see:
GitHub webhooks activated for job fsp1 with [GitHubRepositoryName[host=github.com,username=user,repository=repo]] (events: [PUSH]) PING webhook received from repo <[https://github.com/user/repo]>!I must admit that even for Freestyle project just checking "GitHub project" and specifying repository URL doesn't cut it. Which is strange. Isn't that enough info to create a webhook?
—
UPD I was about to report it again, but found this issue. So let me report again after all.
Environment: Jenkins 2.277, Docker version 18.06.3-ce build d7080c1, Debian GNU/Linux 8, GitHub API Plugin 1.122, GitHub plugin 1.32.0.
Steps to reproduce:
# docker-compose.yml version: '3' services: jenkins: image: jenkins/jenkins:2.277 ports: - 8080:8080$ docker-compose up
- Unlock Jenkins
- Install suggested plugins
- Create a user
- https://github.com/settings/tokens
- Generate new token
- Scopes: repo, admin:repo_hook
- Generate token
- Manage Jenkins > Manage Credentials > (Jenkins/global) > Add credentials
- Kind: Secret text
- Scope: System
- Secret: (the token)
- OK
- Manage Jenkins > Manage Credentials > (Jenkins/global) Add credentials
- Kind: Username with password
- Scope: Global
- Username: (email)
- Password: (password)
- Manage Jenkins > Configure System > GitHub > Add GitHub Server > GitHub Server
- Choose the token credentials
- Test connection (succeeds)
- Check Manage hooks
- Save
- Create a public repository on GitHub with the following Jenkinsfile in the master branch:
pipeline { agent any stages { stage('Stage 1') { steps { sh 'echo $GIT_COMMIT' } } } } - New Item
- Enter an item name
- Pipeline
- OK
- Check GitHub project
- Enter the URL: https://github.com/USER/REPO
- Check GitHub hook trigger for GITScm polling
- Pipeline: Pipeline from SCM
- SCM: Git
- Repository URL: https://github.com/USER/REPO
- Credentials: (credentials)
- Branch specifier: */master (the default)
- Save
- https://github.com/USER/REPO/settings/hooks
No new hooks.
environment
Ubuntu 16.04.2 (Xenial)<br/>
Jenkins 2.60.1<br/>
GitHub plugin 1.27.0
andycoates:
- Original comment link
Raw content of original comment:
I am seeing the exact same issue. Brand new instance (2.73.2) with a similar Pipeline job, but all I see is:
GitHub webhooks activated for job <jobname> with [] (events: [PUSH])If I check on the GitHub side there are no new webhooks added, even though there is a Global config server for GitHub with credentials that test successfully via the Test Connection button.
Feels like something is missing from the workflow/documentation.
I am seeing the exact same issue. Brand new instance (2.73.2) with a similar Pipeline job, but all I see is:
GitHub webhooks activated for jobwith [] (events: [PUSH])
If I check on the GitHub side there are no new webhooks added, even though there is a Global config server for GitHub with credentials that test successfully via the Test Connection button.
Feels like something is missing from the workflow/documentation.
anuragkalia:
- Original comment link
Raw content of original comment:
I am seeing the exact same issue in the latest version of the plugin (1.28.1). Came to report to see but this is already reported.
I am seeing the exact same issue in the latest version of the plugin (1.28.1). Came to report to see but this is already reported.
wanghao02:
- Original comment link
Raw content of original comment:
I am seeing this on jenkins 2.89.3
I am seeing this on jenkins 2.89.3
lordbbk:
- Original comment link
Raw content of original comment:
Still exists on Jenkins ver. 2.107.1
Still exists on Jenkins ver. 2.107.1
docwhat:
- Original comment link
Raw content of original comment:
It looks like the pipeline jobs (flow-definitions) don't understand that the github repository is inside the <definition class="org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition"> section of the config.
On my system it keeps trying to manage a hook on https://github.com/foo/bar when the project I'm working on is in https://github.com/foo/barbaz. It is driving me nuts.
It looks like the pipeline jobs (flow-definitions) don't understand that the github repository is inside the
On my system it keeps trying to manage a hook on https://github.com/foo/bar when the project I'm working on is in https://github.com/foo/barbaz. It is driving me nuts.