# Install Private Dependencies

Analyzers install dependencies for repositories in order to ensure fewer false positives. However, some dependencies in your project may lie in private repositories. When DeepSource tries to install from such repositories, you may get some errors, like the one below:

Unable to install dependencies

In order to give DeepSource access to those repositories, read on.

# Generate the SSH key pair

Go to the Settings page of the repository dashboard in DeepSource and navigate to the SSH Access tab. Click on the Generate SSH key pair button. The public key of the key pair will be available for copying.

Generate SSH Key on DeepSource

# For Github

# For repositories with one private dependency

  1. Navigate to the Deploy keys section in the settings page of the repository that contains the dependency.
  2. Click on Add deploy key button.
  3. Paste the public key provided by DeepSource in the Key field. Name the key suitably in the Title field, so you can refer to it later.
  4. Click on Add key.

Add deploy key to repository

# For repositories with multiple private dependencies

  1. Login as a machine user (create a new GitHub user with a different email, if you do not have a machine user yet).
  • The machine user must be added as a collaborator on your org, and given read permissions to your repositories that contain the dependencies.
  1. Navigate to https://github.com/settings/keys/new while logged in as the machine user, and paste the public key provided by DeepSource in the Key field. Name the Title field.
  2. Click on Add key.

Add SSH key to machine user

# For GitLab

# For repositories with one private dependency

  1. Navigate to the settings page of the repository that contains the dependency.
  2. Navigate to the CI/CD section. Click on Expand button.
  3. Paste the SSH key copied from DeepSource into the key field. Name the Title field suitably.
  4. Click on Add key.

Add deploy key to single repository

# For repositories with multiple private dependencies

  1. Add the SSH key copied from DeepSource to one repository that has a dependency, using the above guide.
  2. Navigate to another repository that needs to be given access to.
  3. Navigate to the CI/CD section in settings. Click on the Expand button.
  4. Click on the Privately accessible deploy keys tab (refer the walkthrough below).
  5. Choose the deploy key that was configured in step 1 and enable it.

Add SSH key to multiple repositories

Last Updated: 9/21/2020, 3:02:40 PM