How do I deploy only a subdirectory of my repository?
Yes. DeployHQ can deploy a single folder from your repository instead of the whole thing. This is useful for monorepos, or when your repository holds the website alongside other files such as documentation or tooling.
Setting the subdirectory
The subdirectory is a setting on each server, so different servers in the same project can deploy different folders.
- Open your project and go to Servers & Groups.
- Edit the server you want to change, or add a new one.
- Expand Deployment Options and find Subdirectory to deploy from.
- Enter the folder as a path relative to the root of your repository, for example
app. A leading slash is not needed. - Save the server and run a deployment.
Only files inside that folder are deployed. If you leave the field blank, the server uses the project's default subdirectory, and if there isn't one, deploys the whole repository.
Two server types handle this differently:
- Shell servers don't have the setting, because they run commands rather than transfer files.
- Static Hosting servers have their own Subdirectory to deploy from field, which points at the folder containing your built site.
You'll also see this option when you set up your first server in the onboarding wizard.
Related
- To deploy more than one folder to the same host, add a server for each folder, each with its own subdirectory.
- If your build runs from a subfolder, see executing build commands in a different directory.
- To leave particular files out of a deployment, use Excluded Files.
- For the full list of options on the server page, see Advanced server configuration.