I am getting the below error when my Bitbucket pipeline fails. I am creating a new AWS AMI using the Packer tool. I am using an Ansible playbook to create a customized AMI. I modified permissions for SSH keys. I am fetching keys from the SSM parameter store. (600 for private key, 400 for public key). I connected to the created AWS instance and copied the key to the created instance; post that, I tried to check out the repo. But during this step my pipeline failed. Below is the error message.
amazon-ebs.this: fatal: [default]: FAILED! => {"changed": false, "cmd": "/usr/bin/git ls-remote [email protected]:companyname/network-monorepo.git -h refs/heads/2022.RTT_29, "msg": "Warning:********@bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.",
"rc": 128, "stderr": "Warning: Permanently added 'bitbucket.org' (ED25519) to the list of known hosts.
Load key "/root/.ssh/bitbucket": error in libcrypto
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
", "stderr_lines": ["Warning: Permanently added 'bitbucket.org' (ED25519) to the list of known hosts.", "Load key "/root/.ssh/bitbucket": error in libcrypto", "[email protected]: Permission denied (publickey).", "fatal: Could not read from remote repository.", "", "Please make sure you have the correct access rights", "and the repository exists."], "stdout": "", "stdout_lines": []}
1