How to set up workspace-wide SSH keys for Pipelines to fetch Golang modules located on Bitbucket?

Pedro
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 6, 2021

Hi, 

I would like to understand how I can set up workspace-wide SSH keys for Pipelines to fetch Golang modules located on Bitbucket, please. 

Thank you!

1 answer

1 accepted

1 vote
Answer accepted
Leonardo M
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 6, 2021

Hi!
Here are the steps to achieve this.

1. Create the ssh key in the pipeline settings for the repo (Repository settings > Pipelines > SSH Keys)

2. Copy the public key to the dependent repo access keys (Repository settings > Access keys)

3. Execute the following command in any context that will need to pull go dependencies. It tells git to rewrite https URLs to ssh URLs:

git config --global url."git@bitbucket.org:<workspaceID>".insteadOf "https://bitbucket.org/<workspaceID>"

4. Also execute the following:

export GOPRIVATE=bitbucket.org/<workspaceID>

This tells golang not to use the public checksum database for dependencies that use that URL.

Vyshakh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 2, 2022

@Leonardo M  how do you do the step 1 for all repo pipelines at single place, say at the workspace level. its a pain to manage the ssh keys at each pipeline level, we need it to be at the workspace or the project level. Even the envirnoment variables are not configurable/overridable at project level. are there anything for this?

Like Rik Burger likes this
cristtopher
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 6, 2022

don't work for me

Rik Burger
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 13, 2024

any update on this by any chance?

Rik Burger
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 13, 2024

configuring this at the workspace level instead of each repo would be greatly appreciated

Anton Larin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 20, 2024

+, Any update?


There seems to be no options to pass ssh private key to all workspace pipelines except for store it in an env variable (which works, but not very elegant).

Another option is workspace-wide access token, but by coincidence this is a paid feature

Any plans to implement this, or any convenient alternative?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events