Rails, Capistrano, Database.yml

I’ve found the easiest way to manage the config/database.yml file in a Rails + Capistrano configuration is to add the following line to your capistrano config/deploy.rb configuration file:

set :linked_files, %w{config/database.yml}

Then add config/database.yml to your .gitignore file.

After which, add your environment’s database.yml file to the appropriate location on the remote server(s):


Where deploy_to is the deploy_to capistrano configuration setting.

This way the configuration parameters are not stored in your repository, but they are still easily updated if needed.

Leave a Reply

Your email address will not be published. Required fields are marked *