3

I have a private github repo set up. I also have git installed and a clone of this repo at subdomain.example.com.

In the root of the subdomain I have a php file that has the following code:

<?php `git pull`;

I have set up a web hook to http://subdomain.example.com/git-pull.php.

However when ever I push a new commit nothing happens on my server. I have followed about 10 different tutorials. Most of which seem to assume you know what you are doing.

This would be the first time I am ever working with GitHub so I really have no clue what I am doing or how to properly accomplish this.

I guess my first question would be how can I even tell if my website is seeing the webhook when ever the repo is updated?

2
  • Have you considered using a service such as DeployHQ? Is listens (using service hook) to Github repo and pushes to the server via FTP / SFTP etc. Commented Dec 18, 2013 at 18:59
  • I had never even heard of this service. I'll look into it. Commented Dec 18, 2013 at 19:05

1 Answer 1

1

I guess my first question would be how can I even tell if my website is seeing the webhook when ever the repo is updated?

The right question is actually the other way around: can the webhook see your website?

There are several things to check:

  1. Go to your GitHub project's page: https://github.com/USERNAME/PROJECT/settings/hooks

  2. Select your WebHook URLs, make sure the URL is correct and click Test Hook

  3. Check your webserver logs and see if GitHub reached your site.

If you get this far then something's wrong with your script.

Btw keep in mind that the web hook sends a POST request not a GET.

Sign up to request clarification or add additional context in comments.

7 Comments

My server does see the webhook. I think the problem I was facing was that I manually edited some files via FTP on the server and when a "git pull" was attempted there were some files that needed to be merged or stashed. I took care of that and now i'll be making some changes and seeing if the results take. Thank you very much for your help!
If you want to cancel all changes before running git pull, you could do git reset --hard
Well, now that I have tested it I can see that my php file is not firing at all. I am so confused as to why its not working.
Do you see the test request from GitHub in your webserver logs?
Yes I do. My php is not firing off when it happens.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.