Me (Amit)

AMWAM - Amit Shah

Agile Software Developer, based in London.

Using Git push-to-deploy

06/02/2015

git

I added the ability to push to deploy.

I found out about Git's 'push to deploy' feature today based on this post and figured its perfect for my setup! My site is built so that I don't have to restart when a new post is added, which means silent updates.

I already had a hook which would check out my repo, and pull the latest changes, whenever I pushed to the bare repo. This makes things simpler as I can now choose exactly when I want to deploy.

To set this up, all you have to do is clone your repo on your server, as you would normally (git clone http://path.to.your.repo), then run the following command to allow pushing into the repo.

git config receive.denyCurrentBranch updateInstead

From your development side, setup a new remote such as prod with the command :

git remote add prod http://path.to.your.production.repo

When ever you want to deploy it becomes a simple case of just running git push prod master.