This one is not mine. It's, actually, a transcript. Please, check out the source at the bottom
#
# Local
#
# Create a website
mkdir website && cd website
git init
echo 'Hello, world!' > index.html
git add index.html
git commit -q -m "The humble beginnings of my web site."
# add remotes
git remote add deploy-production ssh://server.example.org/var/lib/git/deploys/production/website.deploy
# AFTER setting up remote, push files
git push deploy-production +master:refs/heads/master
# update
git push deploy-production
#
# Remote
#
# the repo
mkdir example.org.deploy && cd example.org.deploy
git init --bare
mkdir /var/www/www.example.org
cat << EOF > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE='/var/www/www.example.org' git checkout -f
EOF
# make the hook executable
chmod +x hooks/post-receive
Notes
Setting receive.denycurrentbranch to "ignore" on the server eliminates a warning issued by recent versions of git when you push an update to a checked-out branch on the server.