Skip to content

Instantly share code, notes, and snippets.

@asidbackup
Forked from cowboy/github_post_recieve.php
Created May 17, 2016 13:01
Show Gist options
  • Save asidbackup/8ff189a328987de243bbad4b19bc04c1 to your computer and use it in GitHub Desktop.
Save asidbackup/8ff189a328987de243bbad4b19bc04c1 to your computer and use it in GitHub Desktop.
GitHub PHP webhook to auto-pull on repo push
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ( $_POST['payload'] ) {
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' );
}
?>hi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment