Git Push-to-Deploy

Git 2.4 and above have a simple mechanism that allows you to push to a server to deploy files just as you would push to a repository.

Server Setup

This assumes your server is accessible via SSH.

mkdir my-project cd my-project git init

git config receive.denyCurrentBranch updateInstead

Local Setup

git remote add production ssh://myuser@mydomain.com/var/www/my-project

git push deploy

For info on how to execute commands upon deployment, see Pete Coop’s post.