How to ignore files with Capistrano 3 without copy_exlude

1.5k views Asked by At

In Capistrano 2 it was possible to exclude certain files that live in the Git repository with copy_exclude:

set :copy_exclude, %w{.git .DS_Store web concept config lib}

This isn't possible anymore in Capistrano 3. How can I exclude certain files that I want in my Git repository but not necessarily on my server?

1

There are 1 answers

0
Ole Spaarmann On

The way to achieve this is to add a .gitattributes to the root of your repo. It works very similar to .gitignore. Just add the paths to all the files you want in your repository but not on your staging / production server followed by export-ignore and commit+push the changes.

Sample .gitattributes file:

# Folders
/config export-ignore
/lib export-ignore

# Files
license.txt export-ignore
readme.html export-ignore

Then deploy like usual. More info here