The drop is always movingYou know that saying about standing on the shoulders of giants? Drupal is standing on a huge pile of midgetsAll content management systems suck, Drupal just happens to suck less.Popular open source software is more secure than unpopular open source software, because insecure software becomes unpopular fast. [That doesn't happen for proprietary software.]Drupal makes sandwiches happen.There is a module for that

Make your password protected devsite pull automatically from github

Submitted by nk on Wed, 2011-12-28 21:01

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.

Submitted by Anonymous on Thu, 2011-12-29 17:40.

Tried using the github API ? http://developer.github.com/v3/pulls/

Submitted by nk on Fri, 2011-12-30 07:05.

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?