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?
The way to achieve this is to add a
.gitattributesto 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 byexport-ignoreand commit+push the changes.Sample
.gitattributesfile:Then deploy like usual. More info here