Skip to content

Instantly share code, notes, and snippets.

@Eworm
Created February 26, 2018 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Eworm/6674c2c084d09b9789f20e2413fc4ad3 to your computer and use it in GitHub Desktop.
Save Eworm/6674c2c084d09b9789f20e2413fc4ad3 to your computer and use it in GitHub Desktop.
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ( $_POST['payload'] ) {
$data = json_decode($_POST['payload']);
if ($data->ref == 'refs/heads/master') {
shell_exec( 'cd /home/YOURNAME/webapps/WEBAPPNAME && git pull' );
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment