【发布时间】:2015-06-10 14:35:35
【问题描述】:
在 Capistrano 2 中,可以使用 copy_exclude 排除存在于 Git 存储库中的某些文件:
set :copy_exclude, %w{.git .DS_Store web concept config lib}
这在 Capistrano 3 中不再可能。如何排除某些我想要在我的 Git 存储库中但不一定在我的服务器上的文件?
【问题讨论】:
在 Capistrano 2 中,可以使用 copy_exclude 排除存在于 Git 存储库中的某些文件:
set :copy_exclude, %w{.git .DS_Store web concept config lib}
这在 Capistrano 3 中不再可能。如何排除某些我想要在我的 Git 存储库中但不一定在我的服务器上的文件?
【问题讨论】:
实现这一点的方法是将.gitattributes 添加到您的存储库的根目录。它的工作原理与.gitignore 非常相似。只需在存储库中添加您想要的所有文件的路径,而不是在暂存/生产服务器上,然后添加export-ignore 并提交+推送更改。
示例.gitattributes 文件:
# Folders
/config export-ignore
/lib export-ignore
# Files
license.txt export-ignore
readme.html export-ignore
然后像往常一样部署。更多信息here
【讨论】: