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

getting error when run bitbuket.yml file excute

Jay Khatri
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!
June 7, 2023
i am writing this scrpit fot connecting to ec2 server

script:
- apk add --no-cache openssh-client
- eval $(ssh-agent -s)
- echo "$awskey" | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh


but at line 3 " echo "$awskey" | ssh-add - " it give me error  >  + echo "$awskey" | ssh-add -   Error loading key "(stdin)": error in libcrypto.

I already added a variable in the Repository settings.

please give me solution

Thanks, 

 

 

2 answers

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 9, 2023

Hi Jay and welcome to the community!

Pipelines does not currently support line breaks in environment variables and a private SSH key has line breaks. If you want to add a private SSH key as a variable you can base-64 encode it first and then add the base64-encoded private key in the variable. You can find more details about this here:

However, if you use only one SSH key in your pipeline, then instead of using a variable you can set up SSH keys from the Repository settings > SSH keys page of the repo:

Kind regards,
Theodora

0 votes
Erez Maadani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 7, 2023

Hi @Jay Khatri 

This error is usually triggered upon missing newline or the opening and closing lines of the private key (the ones which start and end with "----"). Try the following solutions:

  1. Try replacing `- echo "$awskey" | ssh-add -` with `- echo "${awskey}" | ssh-add -` 
  2. Try adding again the private key with all its lines, including "-----BEGIN OPENSSH PRIVATE KEY-----" and "-----END OPENSSH PRIVATE KEY-----"

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events