How to ignore files with Capistrano 3 without copy_exlude
In Capistrano 2, it was possible to exclude certain files that are in the Git repository using copy_exclude:
set :copy_exclude, %w{.git .DS_Store web concept config lib}
This is not possible in Capistrano 3. How can I exclude certain files that I want in my Git repository, but not necessarily on my server?
source to share
To achieve this, add .gitattributes
to the root of your repo. It is very similar to .gitignore
. Just add the paths to all the files you want to use in your repository, but not your staging / production server, and then export-ignore
and copy + push changes.
Example .gitattributes
file:
# Folders
/config export-ignore
/lib export-ignore
# Files
license.txt export-ignore
readme.html export-ignore
Then expand as usual. More details here
source to share