I am trying to clone a private repository from BitBucket in a Docker container (with Ansible). I just want to try and get this working, so I copied my public and private key into the container. I then run the following (FWICT this is a simplied version on the Ansible command):
docker exec -i web git clone [email protected]:user/repo.git
And I get this:
Cloning into 'repo'...
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
As a side note, if I run:
docker exec -i -t web git clone [email protected]:user/repo.git
I get a TTY and I get prompted for the SSH private key password (can't seem to do this with Ansible) and the repo gets cloned.
So the question is, how can I clone a private repository within a Docker container without -t? Or does anyone know how to clone a private repo in a container with Ansible?
~/.sshand~/.ssh/id_rsainside the container? (FWIW you might consider just mounting~/.ssh, rather than copying the content.) - Oliver Charlesworthexpectmodule to handle this. - Konstantin Suvorov