Skip to content

24 ways to impress your friends

Vote down?

Seb Duggan

I’ve been deploying via Git for a year or so now, but have a slightly different method (albeit one that probably requires more than just FTP access to a production server).

I set up Git and SSH on my production server; I then init a bare Git repository on the server (but separate from the actual web root). To this I add a “post-receive” hook which runs when the repo is updated, and checks out from the repo to the specified working directory (the web root).

Then you can simply add this as a remote (“production”) on your local repo, and push to this in exactly the same way as you would to Bitbucket etc. The repo is updated on your production server, and then when it has completed, the code is instantaneously checked out into your web root.

Full details of this slightly different method here: http://sebduggan.com/blog/deploy-your-website-changes-using-git/