1

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.

Vish Shady
  • 327
  • 1
  • 5
  • 15

1 Answers1

1

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.

enter image description here

Community
  • 1
  • 1
Wade Williams
  • 3,943
  • 1
  • 26
  • 35