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://

# AFTER setting up remote, push files
git push deploy-production +master:refs/heads/master

# update
git push deploy-production

# Remote

# the repo
mkdir && cd
git init --bare
mkdir /var/www/

cat << EOF > hooks/post-receive

GIT_WORK_TREE='/var/www/' git checkout -f


# make the hook executable
chmod +x hooks/post-receive


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.