I am trying to git clone
from inside a docker container to a private repository using ssh authentication. I followed a solution presented here.
To do so, I created a local key
ssh-keygen -q -t rsa -N '' -f repo-key
and added the public key to the github
ssh keys. Then in the Dockerfile I added:
RUN chmod 600 repo-key && \
echo "IdentityFile /selenium/repo-key" >> /etc/ssh/ssh_config && \
echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
But when I try to git clone
a repository I got the error message
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Anything else I can check to make this work?
Again to explain the WHY: I want to be able to create images with a FIXED private key which ALWAYS works with the public key at github, so I can use the SAME image, but able to download the actual/current repository into the running container. The image is equipped with the correct keys, so it has access to the github repository and able to download the current repository when a contained is started from the same image... The image is for selenium tests, which will later executed automatically by a script (or jenkins), and then I am not able to 'log in' to the container to create a ssk key pair and upload the public key to github. The whole thing is to automate the testing. Therefore, the authentification has to be build into the image.
HOPEFULLY this is clear now.