Pull code from a private Git repository
On this page
To complete its build, your Platform.sh project may need to access pieces of code stored in private Git repositories. Examples include themes, libraries, and modules. Configure these repositories to grant access to your project.
To grant access to a private Git repository, add the project’s public SSH key to your Git repository’s deploy keys.
- In the Console, open the project you want.
- Click Settings.
- Under Project settings, click Deploy key.
- Click Copy.
If you’re only pulling code, the key doesn’t need write permissions.
Now your Platform.sh project can access your private repository via SSH, including to add dependencies.
This means you can access the private repository through links like:
For example, you can clone a repository in your
git clone email@example.com:username/module.git
You can also use private repositories as submodules.
GitHub requires a separate deploy key for each repository. To grant your project access to multiple repositories, create an automated user account, known as a machine user, with its own SSH key.
You can then add the machine account as collaborator to specific repositories or to a team with access to the repositories.
See more information about machine users on GitHub.