|
| 1 | +Using Private Git Submodules |
| 2 | +============================ |
| 3 | + |
| 4 | +.. warning:: |
| 5 | + |
| 6 | + This guide is for :doc:`/commercial/index`. |
| 7 | + |
| 8 | +Read the Docs uses SSH keys (with read only permissions) in order to clone private repositories. |
| 9 | +A SSH key is automatically generated and added to your main repository, but not to your submodules. |
| 10 | +In order to give Read the Docs access to clone your submodules you'll need to add the public SSH key to each repository of your submodules. |
| 11 | + |
| 12 | +.. note:: |
| 13 | + |
| 14 | + You can manage which submodules Read the Docs should clone using a configuration file. |
| 15 | + See :ref:`config-file/v2:submodules`. |
| 16 | + |
| 17 | + |
| 18 | +.. contents:: Table of contents |
| 19 | + :local: |
| 20 | + :backlinks: none |
| 21 | + :depth: 2 |
| 22 | + |
| 23 | + |
| 24 | +Copy your project's SSH Key |
| 25 | +--------------------------- |
| 26 | + |
| 27 | +You can find the public SSH key of your Read the Docs project by |
| 28 | + |
| 29 | +#. Going to the :guilabel:`Admin` tab of your project |
| 30 | +#. Click on :guilabel:`SSH Keys` |
| 31 | +#. Click on the fingerprint of the SSH key (it looks like ``6d:ca:6d:ca:6d:ca:6d:ca``) |
| 32 | +#. Copy the text from the ``Public key`` section |
| 33 | + |
| 34 | +.. note:: |
| 35 | + |
| 36 | + The private part of the SSH key is kept secret. |
| 37 | + |
| 38 | +Add the SSH key to your submodules |
| 39 | +---------------------------------- |
| 40 | + |
| 41 | +GitHub |
| 42 | +~~~~~~ |
| 43 | + |
| 44 | +For GitHub, Read the Docs uses `deploy keys with read only access <https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys>`__. |
| 45 | +Since GitHub doesn't allow you to reuse a deploy key across different repositories, |
| 46 | +you'll need to use `machine users <https://developer.github.com/v3/guides/managing-deploy-keys/#machine-users>`__ |
| 47 | +to give read access to several repositories using only one SSH key. |
| 48 | + |
| 49 | +#. Remove the SSH deploy key that was added to the main repository on GitHub |
| 50 | + |
| 51 | + #. Go to your project on GitHub |
| 52 | + #. Click on :guilabel:`Settings` |
| 53 | + #. Click on :guilabel:`Deploy Keys` |
| 54 | + #. Delete the key added by ``Read the Docs Commercial (readthedocs.com)`` |
| 55 | + |
| 56 | +#. Create a GitHub user and give it read only permissions to all the necessary repositories. |
| 57 | + You can do this by adding the account as: |
| 58 | + |
| 59 | + - A `collaborator <https://help.github.com/en/github/setting-up-and-managing-your-github-user-account/inviting-collaborators-to-a-personal-repository>`__ |
| 60 | + - An `outside collaborator <https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/adding-outside-collaborators-to-repositories-in-your-organization>`__ |
| 61 | + - A `team in an organization <https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/adding-organization-members-to-a-team>`__ |
| 62 | + |
| 63 | +#. Attach the public SSH key from your project on Read the Docs to the GitHub user you just created |
| 64 | + |
| 65 | + #. Go to the user's settings |
| 66 | + #. Click on :guilabel:`SSH and GPG keys` |
| 67 | + #. Click on :guilabel:`New SSH key` |
| 68 | + #. Put a descriptive title and paste the |
| 69 | + #. :ref:`public SSH key from your Read the Docs project <guides/private-submodules:Copy your project's SSH key>` |
| 70 | + #. Click on :guilabel:`Add SSH key` |
| 71 | + |
| 72 | +GitLab |
| 73 | +~~~~~~ |
| 74 | + |
| 75 | +For GitLab, Read the Docs uses `deploy keys with read only access <https://docs.gitlab.com/ee/ssh/#deploy-keys>`__, |
| 76 | +which allows you to reuse a SSH key across different repositories. |
| 77 | +Since Read the Docs already added the public SSH key on your main repository, |
| 78 | +you only need to add it to each repository of your submodules. |
| 79 | + |
| 80 | +#. Go to the project of your submodule on GitLab |
| 81 | +#. Click on :guilabel:`Settings` |
| 82 | +#. Click on :guilabel:`Repository` |
| 83 | +#. Expand the :guilabel:`Deploy Keys` section |
| 84 | +#. Put a descriptive title and paste the |
| 85 | +#. :ref:`public SSH key from your Read the Docs project <guides/private-submodules:Copy your project's SSH key>` |
| 86 | +#. Click on :guilabel:`Add key` |
| 87 | +#. Repeat the previous steps for each submodule |
| 88 | + |
| 89 | +Bitbucket |
| 90 | +~~~~~~~~~ |
| 91 | + |
| 92 | +For Bitbucket, Read the Docs uses `access keys with read only access <https://confluence.atlassian.com/bitbucket/access-keys-294486051.html>`__, |
| 93 | +which allows you to reuse a SSH key across different repositories. |
| 94 | +Since Read the Docs already set the public SSH key on your main repository, |
| 95 | +you only need to add it to each repository of your submodules. |
| 96 | + |
| 97 | +#. Go to the project of your submodule on Bitbucket |
| 98 | +#. Click on :guilabel:`Settings` |
| 99 | +#. Click on :guilabel:`Access keys` |
| 100 | +#. Click on :guilabel:`Add key` |
| 101 | +#. Put a descriptive label and paste the |
| 102 | +#. :ref:`public SSH key from your Read the Docs project <guides/private-submodules:Copy your project's SSH key>` |
| 103 | +#. Click on :guilabel:`Add key` |
| 104 | +#. Repeat the previous steps for each submodule |
| 105 | + |
| 106 | +Others |
| 107 | +~~~~~~ |
| 108 | + |
| 109 | +If you are not using any of the above providers. |
| 110 | +Read the Docs will still generate a pair of SSH keys. |
| 111 | +You'll need to add the :ref:`public SSH key from your Read the Docs project <guides/private-submodules:Copy your project's SSH key>` |
| 112 | +to the main repository and each of its submodules. |
| 113 | +Refer to your provider's documentation for the steps required to do this. |
0 commit comments