GDT
GDT

Reputation: 314

How to push from GitHub to your VPS

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?

Upvotes: 3

Views: 1453

Answers (1)

janos
janos

Reputation: 124648

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.

Upvotes: 1

Related Questions