Push-based Remote Deployment with Git (Revised)

Git is everyday. It has become an essential in the programmer’s toolbox and supports all the good buzzwords – maintainability, agility, predictability, you name it. The hooking functionality it provides has spawned an industry of its own, with companies like Codeship, Hakiri, Travis CI and such being fundamentally structured atop it.

These hooks are straight forward to work with, so just as the creators of those companies would’ve, we can jump in and have a go ourselves. I use it so I can easily push changes to web servers, etcetera, instead of having to manually (and error prone-ly) sync files, and that’s what I’ll be demonstrating here – one push to deploy.

It’ll be a simplified version of Digital Ocean’s great Git hooks post, and an improvement to a similar post I wrote almost a year ago (which has a critical security flaw (see my comment on that post)).

So lets get started…

Continue reading “Push-based Remote Deployment with Git (Revised)”

@abestanway’s Commit Logs From Last Night (@CLFLN) cracks me up… and helps me feel human again: http://t.co/LHk1tr3JdJ

Rapid Deployment with Git (Insecure)

Warning: The technique illustrated in this walkthrough is insecure. I’ve created a revised version without this problem, but am leaving this post here for awareness. Read this article and my comments immediately below to learn about the security problem and avoid it in your future work, and don’t hesitate to ask me anything if you’re unsure about the problem.

This walkthrough assumes you have an existing project and Git repository, and that you want to set up easy and quick remote deployment – maybe to a web server.

This technique can be used for any project where you’re comfortable with simply pushing updates to a location and seeing them immediately active.

This works great for code bases like the one for this blog or any basic website you may be managing. However with larger projects that need automated testing and CI, etcetera, it may not be sufficient.

If this suits your needs, you’ll save a whole heap of time whenever you need to update a destination with your changes.

The final assumptions are that Git is installed and usable at the destination (if it’s not, you can easily add it following this guide), and that you won’t actually be coding or making any direct changes at the destination. Instead we’ll push in any changes and trust me, when you see how easy it is, you won’t need to make on-the-server/spot changes ever again – even for hotfixes and tiny bugs.

Continue reading “Rapid Deployment with Git (Insecure)”