<?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' ); } } ?>