This script will help to create a git repo and also a virtual host on your system. You can clone and commit to the repo, all the changes will be directly applied to the production server — i.e. git with auto pull feature.
This assumes that you have a user called git and Apache installed on your server.
The key components:
1. Create a bare git repository
2. Set up a post-receive hook for auto-deployment
3. Configure the Apache virtual host
4. Clone and start pushing
The post-receive hook is what makes the magic happen:
#!/bin/bash
GIT_WORK_TREE=/var/www/yoursite git checkout -f