Header

Excluded Files

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 of the file as it's stored in the repository (not as it's placed on the server) as the name, or one of the standard recipes if you want to exclude directories or specific file types.

Excluded File

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.

Common Recipies

Some working examples of file exclusion rules might look like so:

  • vendor - Only your vendor directory will be excluded, anything inside vendor will still be uploaded
  • vendor/** — All files and subdirectories within your vendor directory will be excluded from deployments, the vendor folder itself will still be uploaded.
  • node_modules - Only your node_modules directory will be excluded, anything inside node_modules will still be uploaded
  • node_modules/** — All files and subdirectories within your node_modules directory will be excluded from deployments, the node_modules folder itself will still be uploaded.
  • **/*.yml — Any yml files will be excluded from deployments
  • config/*.php — All PHP files, only within your config directory will be excluded from deployments

As per the examples above, you will always need to add two rules to exclude a folder, as well as its contents.

Whitelisting files and directories

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:

  • !vendor/directory-to-keep/**

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:

  • !config/file-to-keep.php

.deployignore

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.

Proudly powered by Katapult. Running on 100% renewable energy.