Excluded files in DeployHQ are files that you need to store in your repository, or that might be generated within a build pipeline but not upload to your server. This might be useful for certain files within your app that you want to version control but not actually deploy.
To add an excluded file, head to your project's Settings dropdown, then the Excluded Files option. Click to add a new excluded file, entering the full path as the name, or one of the standard recipes if you want to exclude directories or specific file types.
If you want to exclude files for certain server environments in your project, uncheck the Exclude this file on all current and future servers? option and select individual servers.
Some working examples of file exclusion rules might look like so:
vendor/**— All files and subdirectories within your vendor directory will be excluded from deployments
**/*.yml— Any yml files will be excluded from deployments
config/*.php— All PHP files, only within your config directory will be excluded from deployments
You can also whitelist files or directories that are within an excluded pattern.
If you're excluding everything within
vendor/** for example, you might decide you want to keep one folder. Simply add the rule and prepend it with an
! symbol. It would look like this:
Files work in the same way, if you follow the above example where you're ignoring all php files in your config directory, you can allow a specific file like this:
As well as adding excluded file rules in DeployHQ, you can add a .deployignore file to your repository containing rules in the exactly the same format and store it in your repository. Just add each rule on a new line, then DeployHQ will check this file and exclude any files or directories from the deployment as appropriate.
DeployHQ doesn't have support for specifying specific servers in .deployignore, therefore if you need to configure rules for certain servers, you'll need to use the Excluded Files feature in the DeployHQ interface.