Simple and secure post-receive hook. The script is written in PHP and allows you to automatically deploy a github, bitbucket, gitlab or any other git hosted repo to a production server.
The script uses a GET request to authenticate Github to do a "git push", so any stranger donsn't push the repo accidentally.
- Configure
deploy.phpwith a new secure key in the GET-request code on line 7. - Upload
deploy.phpto the webserver and put it somewhere in the root of youre website e.g. /var/www/yourewebsite. - Go to WebHooks in Github or any other service and set the post-recive url to
http://example.com/deploy.php?YOURESECUREKEY