0

I'm very new to running a Git server, and I needed to trigger a Jenkins build upon pushing to Git.

A tutorial says to do this command:

curl http://[jenkins]/git/notifyCommit?url=[job]

but it doesn't tell you how to trigger that cURL upon a git push. Am I reading this wrong? If not, how do I do so? If I am, what am I supposed to do with this command?

1 Answer 1

1

I found it out by searching around the repo... you need to make the file

/path/to/repository/.git/hooks/post-commit

and add

 #!/bin/sh
 curl http://[jenkins]/git/notifyCommit?url=[job]
3
  • 1
    Well you if you wanted to trigger after the push, not commit, it needs to be in post-receive hook for that repo. Apr 28, 2013 at 2:39
  • @DanilaLadner if you want to put that as an answer I will accept it.
    – Ryan
    Apr 28, 2013 at 2:51
  • No worries. That is fine. Apr 28, 2013 at 2:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.