Last Updated: September 29, 2021
· jonesbp

Capistrano remote_cache

Capistrano allows you to cache your deployment repo to make deployment much faster. Add the following line to your deploy.rb:

set :deploy_via, :remote_cache

and Capistrano will run git pull (or the equivalent for your source control system) against this cache rather than checking out the whole repository.

If you're like me and set up your deployment script and forget about it, this line can bite you if you start deploying from a new repository. You'll start getting an error that the repository is not found.

Just delete the shared/cached_copy directory from your deployment. When Capistrano does not find this directory, it will create it for you and save a new cache there. This new cache will be from the new repo and won't cause you any more problems.