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.
![]()
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 Recipes
Some working examples of file exclusion rules might look like so:
Basic Directory Exclusions
vendor- Only your vendor directory will be excluded, anything inside vendor will still be uploadedvendor/**- All files and subdirectories within your vendor directory will be excluded from deployments, the vendor folder itself will still be uploaded.node_modules- Only yournode_modulesdirectory will be excluded, anything inside node_modules will still be uploadednode_modules/**- All files and subdirectories within yournode_modulesdirectory will be excluded from deployments, thenode_modulesfolder itself will still be uploaded.
As per the examples above, you will always need to add two rules to exclude a folder, as well as its contents.
File Type Exclusions
**/*.yml- Any yml files will be excluded from deployments**/*.log- Exclude all log files anywhere in the repository**/*.env- Exclude all environment filesconfig/*.php- All PHP files, only within your config directory will be excluded from deployments
Specific Path Exclusions
/readme/- Exclude the readme directory at the root of your repository/site/assets/files/- Exclude a specific nested directoryCOPYRIGHT.txt- Exclude a specific file at the rootREADME.md- Exclude a specific file at the root.env-sample- Exclude dotfiles.editorconfig- Exclude configuration files
Pattern Matching Examples
/site/templates/custom/default- Exclude a specific subdirectory/site/templates/custom/_starter- Exclude directories starting with underscore/site/templates/custom/ins-*- Exclude all directories starting with "ins-"/site/templates/custom/opt-*- Exclude all directories starting with "opt-".github/- Exclude GitHub-specific files and directories
Build Tool Exclusions
package.json- Exclude npm package configurationpackage-lock.json- Exclude npm lock file.babelrc- Exclude Babel configuration.prettierrc.json- Exclude Prettier configuration.prettierignore- Exclude Prettier ignore fileDockerfile- Exclude Docker configuration.nvmrc- Exclude Node version manager configuration.tool-versions- Exclude version management files
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.
Viewing Excluded Files in Deployment Reports
When you run a deployment, you can see which files were excluded in the deployment report. To view the deployment report:
- Navigate to your project's deployments page
- Click on a completed deployment
- View the deployment report which shows all steps
During the "Generate Manifest" step of the deployment, DeployHQ will log a list of files that were excluded. For example, if you have excluded files, you'll see a log entry like:
Excluded files for server 'Production Server'
- README.md
- node_modules/package.json
- vendor/bundle/gem.rb
- docs/guide.md
- docs/api.md
This helps you verify that your exclusion rules are working as expected and gives you visibility into which files are being filtered out of your deployments.