0
votes

I want to add some automated builds for my docker containers, so I linked my bitbucket account with docker. Then I created an automated build and choose a private bitbucket repo.

If I now trigger a build the build failed with the following error message:

Failed to clone repository: Cloning into '/tmp/build_xxxx'... Warning: Permanently added the RSA host key for IP address '131.103.20.xxx' to the list of known hosts. Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

For public repos the build works without any problems.

Any ideas why private repos are not working?

1

1 Answers

3
votes

You need to add the rsa public key of the user in your Docker container that you are using to connect to BitBucket

Bitbucket

Generally the public key is under:

~/.ssh/id_rsa.pub

or you can generate one:

user@host $ ssh-keygen

then commit your docker container to create a new image:

docker commit <container-id> mycontainer:0.1