4

I have a network share on which a GIT repository resides in. On my local machine I have checked out the GIT repository, where I'm working on with Xamarin Studio with the integrated GIT client. Additionally, I have installed Jenkins for continuous integration. This is all working so far.

Now I want to notify Jenkins when something is commited to this repository. In How can I make Jenkins CI with git trigger on pushes to master? it is stated that I should create a github post-receive trigger after setting the Poll SCM option.

The post from Nav says that I only have to create a post-commit file in the hooks folder with the content similar to

#!/bin/sh
#
# A script which triggers the Jenkins build after a commit.
curl http://localhost:8080/jenkins/git/notifyCommit?url=http://localhost:8080/job/MyJobName/

but if I try to open the URL in the browser I get

HTTP ERROR 404

Problem accessing /jenkins/git/notifyCommit. Reason:

Not Found

Now I exchanged the URL for

http://yourserver/jenkins/git/notifyCommit?url=<URL of the Git repository>

and calling this URL directly in the browser leads to a build. Putting this into the script doesn't trigger a build after a commit. I put the hook into the above mentioned directory on the network share. Putting the script on the local repository also didn't triggered the build.

So how can I create such a git post-receive trigger, which works together with Xamarin Studio?

Edit:

Now I changed the permission of the local hook to 755 and really removed the file extension, but the build is not triggered.

Community
  • 1
  • 1
testing
  • 19,681
  • 50
  • 236
  • 417

1 Answers1

6

I don't know if you fixed this already - it's been a while...

But I was just experiencing the same problem, and found it was due to an incorrect URL:

Try curl http://localhost:8080/git/notifyCommit instead (without jenkins/).

Steve Folly
  • 8,327
  • 9
  • 52
  • 63
  • My issue was very similar. It turned out that I had forgotten to include the port of 8080 in the URL. – Shadoath Mar 27 '19 at 17:30