Git as deployment tool



This is the simplest way to setup a push-to-deploy system. You do not need any scripts, services or version control hosting to make it work. You just need to have ssh and git on your machine and server.

Run these commands on your remote server, in the folder you wish to deploy:

git init --bare
git config receive.denycurrentbranch ignore
echo "git checkout -f" >> .git/hooks/post-receive
chmod +x .git/hooks/post-receive

Now run this in your local repository:

git remote add server ssh://
git push server master
git push --set-upstream server master

That's it! Just push your changes to remote and they will be live. You can set any commands to be executed after deployments in .git/hooks/post-receive.