Use a private Git repository

Pull code from a private Git repository 

Let’s say you’re building a module (or theme, library…) which is stored in a private Git repository that you have access to, and you want to use it on your project. allows you to include code dependencies that are stored in external private Git repositories.

To grant access to your private Git repository, you need to add the project’s public SSH key to the deploy keys of your Git repository.

You can copy your project’s public key by going to the Settings tab on the management console and then clicking the Deploy Key tab on the left hand side.

Deploy Key

If your private repository is on GitHub, go to the target repository’s settings page. Go to Deploy Keys and click Add deploy key. Paste the public key and submit. The GitHub default, is for deploy keys to be read only, so you don’t need to worry about the system pushing code to the private repository.

If you’re using Drupal, for example, you can now use your private module by adding it to your make file:

; Add private repository from GitHub
projects[module_private][type] = module
projects[module_private][subdir] = "contrib"
projects[module_private][download][type] = git
projects[module_private][download][branch] = dev
projects[module_private][download][url] = ""

Using multiple private Git repositories 

More complex projects may have many repositories that they want to include, but GitHub only allows you to associate a deploy key with a single repository.

If your project needs to access multiple repositories, you can choose to attach an SSH key to an automated user account. Since this account won’t be used by a human, it’s called a machine user. You can then add the machine account as collaborator or add the machine user to a team with access to the repositories it needs to manipulate.

More information about this is available on GitHub.