Reputation: 327
I have installed Jenkins on windows machine, configured a project with git repo. My goal is to automatically build project when someone commits into github. To achieve this goal, i updated "Post-Receive" (no extn) file under .git/hooks directory. Code looks like this
#!/bin/bash
curl http://localhost:9090/job/MyProject/build?token=mytoken
When i execute curl http://localhost:9090/job/MyProject/build?token=mytoken
command or sh post-receive
, jenkins job will trigger.
Jenkins job is not triggered when i push changes into git repo (from another machine). Kindly share your thoughts which will help me to resolve this issue.
Upvotes: 1
Views: 1010
Reputation: 4140
First, GitHub supports Webhooks, not post-receive hooks.
You can configure webhooks in the your GitHub repository settings: github.com/[owner]/[repository]/settings/hooks
However, if you're trying to fire off a Jenkins job, you should look into the existing Services hooks to Jenkins.
Upvotes: 1