This is just a quick post for a reminder and maybe to help the odd person out there. But basically I noticed my Capistrano doing a git clone each time I did a deploy.. this is annoying for a few reasons..

Everytime I would make a change, even a small change like a sentence in a README file, and ran a cap deploy, Capistrano would do a git clone each time.

Now.. let’s say your in development or staging and you do 4 or 5 deploys a day.. and let’s also say that your codebase is 20MB. This means that doing about 80-100MB of bandwidth per day. Not to mention how much slower your deploys become or the fact that you’ll be paying for extra bandwidth charges to whomever you host your private repos with.

The simple fix :)

simply add the following lines to your recipe :

set :deploy_via, :remote_cache
set :git_shallow_clone, 1

That’s just a fancy way of saying to use a cache and run a git fetch/pull to that instead of an entire git clone each deploy.

This should save time and bandwidth.. YAY!

Tags: ,