Many projects these days keep their work in github and it is a request often to make some dev site automated automatically. When I tried to enter a passworded URL into github, it didn't work. So I came up with what's below.
Create a PHP file (I have used a filename containing 63 alphanumeric characters but only because I am paranoid):
<?php
exec('git pull', $output);
file_put_contents('/tmp/gitpulllast', date('c') . "\n" . implode("\n", $output));
then change the password-protecting .htaccess:
SetEnvIf Request_URI "/path/to/the/above.php$" github_uri
AuthType Basic
AuthName "this is my devsite"
AuthUserFile "/path/to/htpasswd"
require valid-user
Deny from all
Allow from env=github_uri
Satisfy any
then supply the URL to github as a post receive hook URL.
Edit: for this, you need a passwordless SSH key on the server and added to github.
Commenting on this Story is closed.
Tried using the github API ? http://developer.github.com/v3/pulls/
You still need a trigger. Once triggered, why would I bother with authenticating with github and doing a pull from PHP instead of just running git pull?