Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SSH access for submodules in docker when using bitbucket-pipelines

Maxim Leonov
Contributor
May 13, 2018 edited

Hello

 

I am getting confused wrt using ssh access for submodules when cloning into a docker image.

Various posts in Atlassian Community instruct to enable SSH access.

This is what is unclear to me at this stage:

1. Which repo do I need to enable SSH keys pair on? The parent repo or the submodules repo? How to set up the keys (both public and private) in either of the scenarios?

2. Known hosts for docker image - how do I handle it from bitbucket's settings? As it asks for host address and I'm not sure what to provide there.

 

Thanks.

1 answer

1 accepted

1 vote
Answer accepted
Maxim Leonov
Contributor
May 14, 2018 edited

After digging around I finally got it, so I can answer my own question in case it'll help someone else :  

  1. Generate SSH key for the parent repo using bitbucket's web interface. Use Step 1 from here. Copy the generated public key.
  2. For the submodule repo go to `Settings` -> `Access keys` and add the copied public key. Repeat this for all the submodules you use.
  3. Remember to change the protocol from `https://` to `git@` in your .gitmodules file of the parent repo. As well as adjust the URL (there has to be a colon : after bitbucket.org not a slash).
  4. For nested submodules add public SSH key of the parent repo (the one you are building).
  5. Add `git submodule update --init --recursive` to your `bitbucket-pipelines.yml` file
  6. Profit

You don't need to worry about `Known hosts` section of the `Settings` page in the parent repo, so long as your submodules repos are hosted on bitbucket.org (it is handled behind the scenes).

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events