title: Github + Jenkins >> How to trigger build on "Commit and Push" in code repository?
body: <ul>
  <li>I have setup a local instance of Jenkins on my computer, and I can
  access it through - "<a href="http://localhost:8080" rel="nofollow">http://localhost:8080</a>".</li>
  <li>Created a Public Git repository, and added my ASP.NET MVC
  project there.</li>
  <li>Also configured Jenkins to build the project, and it does the job
  very well.</li>
  </ul>
  
  <p>However, this is a manual trigger. I mean, the build gets triggered only when a user clicks on "Build Now" in Jenkins console.</p>
  
  <p>Actually, my requirement is to trigger a build when the changes are committed and pushed. (that means, "Commit and Push" while checking-in changes).</p>
  
  <p>I referred to a lot of blogs and posts, and came to know about Git hooks. I also tried creating "post-receive" hook. I created a hook at the location where source code is mapped (For example, "E:\Git\test-jenkins.git\hooks").</p>
  
  <pre><code>#!/bin/bash
  curl POST "http://localhost:8080/job/Test-Jenkins/build" --data delay=0sec
  </code></pre>
  
  <p>But this doesn't work. A build is never getting triggered on "Commit and Push". when I try copying the URL directly in the browser, it triggers a build, so I believe there is no issue with the URL. But the script itself is not getting executed.</p>
  
  <p>Could anyone please suggest how to solve this problem?</p>
  
  <p>Any help on this much appreciated.</p>