Skip to content

Instantly share code, notes, and snippets.

@Neal
Created December 14, 2015 05:14
Show Gist options
  • Save Neal/062d3ba9761970ad9d8c to your computer and use it in GitHub Desktop.
Save Neal/062d3ba9761970ad9d8c to your computer and use it in GitHub Desktop.
a simple php webhook receiver to update repo
<?php
if (!$_GET['access_token'] || $_GET['access_token'] !== '__ACCESS_TOKEN__') {
die(header('HTTP/1.1 403 Forbidden'));
}
$commands = array(
'cd /path/to/project',
'git reset --hard HEAD',
'git pull --force origin master'
);
print shell_exec(implode($commands, ' && '));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment