Open navClose nav

Using Private Git Submodules with Forestry

If your website uses submodules from private repos, you will need to configure your site to allow Forestry to access these submodules. For sites stored on GitHub or GitLab, our quick setup flow will not grant the correct permissions. This flow adds a deploy key to your GitHub or GitLab repo, which only grants access to a single repository and will not allow Forestry to install private submodules.

To use a site containing private submodules with Forestry, you will need to change the way Forestry authenticates with Github/GitLab.

  1. Remove deploy key from the repository settings, e.g. ($username/$repository/settings/keys)
  2. In your Forestry site, head to Settings > Repository, show and copy the public key
  3. Add your site’s public key as a user-level key (GitHub/GitLab). This user must have access to these private submodules.
This will give Forestry access to all of your user’s repos. If you would prefer not to do that, just create a new GitHub/GitLab user with access to all of the necessary repositories and add the key to their account.
This is typically not an issue for projects stored on Bitbucket or Azure DevOps because you must add Forestry’s public key to your user account (Azure Devops doesn’t have deploy keys, and deploy keys are always read-only for Bitbucket repos). If you’re having trouble installing private submodules in Bitbucket or Azure DevOps, ensure your user has access to all of the necessary repositories.

Last updated on May 2, 2019