I have an existing SSH keypair and I added it to my Pipeline configuration as per https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html.
I have also added the public key to the "SSH Keys" section under our team, that contains all our private repositories.
During our build we clone many of our repositories as dependencies and I don't want to go into each and add the public key under the repo "Access Keys", I want to do it globally under the team, so that the Pipeline has access to all repositories when cloning.
It does not seem to work and I get the following:
<span>Warning: Permanently added the RSA host key for IP address '18.205.93.1' to the list of known hosts.</span>
<span>Permission denied (publickey).<br></span><span>fatal: Could not read from remote repository.<br><br></span><span>Please make sure you have the correct access rights</span> <span>and the repository exists.<br></span><span>ERROR: sh(git clone -n <a href="mailto:git@bitbucket.org" target="_blank" rel="noopener nofollow noreferrer">git@bitbucket.org</a>:<team>/xxx.git xxx) </span><span>failed with return code 128</span><span>Cloning into 'xxx'...<br></span>
I have replaced the repository name with "xxx" and our team with <team>. For interest, we are using rebar as build tool that clones the dependencies.
Another thing that I pick up is that when a key is added globally, i.e. under the team, it gives an error when you try to add it to individual repositories, is that expected? Even adding this existing key to the individual repository gives the same error, and I have confirmed that it is indeed using my private key in the Pipeline by inspecting /opt/atlassian/pipelines/agent/ssh/id_rsa.
Any ideas why my own keys don't work or how I can debug it further, command I can execute in the Pipeline to see...