Skip to content

Instantly share code, notes, and snippets.

@diegoos
Forked from youhide/github_post_recieve.php
Created August 17, 2017 15:29
Show Gist options
  • Save diegoos/47c56138b97c4b92b6f63ff32299e7c8 to your computer and use it in GitHub Desktop.
Save diegoos/47c56138b97c4b92b6f63ff32299e7c8 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