Clone submodules during deployment
Upsun allows you to use submodules in your Git repository. They’re usually listed in a.gitmodules file at the root of your Git repository.
When you push via Git, Upsun tries to clone them automatically.
The following example is based on a Bigfoot multi-app project which uses the following submodules:

- A BigFoot app
- An API Platform v3, Admin component
- A Gatsby frontend
- A Mercure Rocks server
.gitmodules file:
git push, you can see the output of the logs:
If your submodule contains an independent app,
see how to configure it properly.
Update submodules
- Manual update
- Automated update
When you amend your submodules’ code, make sure your changes are applied by running the following commands
before redeploying:
To specify which submodule needs to be updated, replace
[submodule] with your submodule path.Error when validating submodules
Using an SSH URL (git@github.com:...) to fetch submodules triggers the following error:
https://github.com/...) instead.
Use private Git repositories
When using Git submodules that are private repositories, URLs with the HTTPS protocol fail with errors such as the following:-
Change your module declarations to use SSH for URLs.
Your existing declaration might look like this:
Change this to the following:.gitmodules.gitmodules
- Add the project’s public key to your remote Git repository. If there are nested submodules in your submodule, then add the public key to those repositories as well. This allows your Upsun project to pull the repository from the remote Git service.
Deploy keys only grant access to a single repository,
which can cause issues when attempting to pull several repositories to the same server.
If your server needs access to multiple repositories, follow these steps:
- Create a machine user with access rights to each of the private repositories.
- Attach the deploy key to your machine user.
Removing submodules
These steps aren’t specific to Upsun, but kept as a reference for Git so that submodules are effectively removed before entering the build process.-
In your
.gitmodulesand.git/configfiles, delete the information related to the submodule you want to remove. -
Stage changes to
.gitmodules: -
Remove the submodule from the repository (without trailing slash):
-
Remove the submodule files in
.gitfrom the repository (without trailing slash): -
Commit the changes:
-
Remove the submodule code locally, now no longer tracked: