Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Accessing repo's ssh public key in pipeline script Edited

Mike Pham I'm New Here Aug 05, 2021

Is there a way that I get the SSH public key that I set up for the repository? I've tried looking into the .ssh directory and I can't find id_rsa.pub. I also looked into .ssh/config and I can see that the identity file is in /opt/atlassian/pipelines/agent/ssh, but I can't find any public key in there either.

1 answer

0 votes

Hi @Mike Pham and welcome to the community!

I don't think that the public SSH key is available, but you can create the file in the script of the step where you want to use it, and then access it.

If you add the following command in your script

ssh-keygen -y -f /opt/atlassian/pipelines/agent/ssh/id_rsa > /tmp/id_rsa.pub

it will create the public SSH key from the repo's private SSH key and store it in /tmp directory (because it is not possible to write in the directory /opt/atlassian/pipelines/agent/ssh/).

Another way would be to copy the public key from the repo's Settings and use that command instead in the script:

echo "paste_public_key_here" >> /tmp/id_rsa.pub

That command would need to get updated though if you decide to change the SSH keys in the repository.

Please feel free to let me know if that works for you and if you have any questions.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to
This widget could not be displayed.
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Delivery and Operations Teams can be more Effective and Profitable

    Managing services end-to-end, optimizing efforts to deliver the best services to customers. This is what team leaders and managers want to achieve. When using a tool like Jira, it...

22 views 0 0
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you