I work with bitbucket repos as a team player. I've got multiple identities on my laptop, say id_rsa and deploy which I generated with
id_rsa:
ssh-keygen
deploy:
ssh-keygen -f ~/.ssh/deploy -C "deploy"
and a config file
Host bitbucket.org
HostName bitbucket.org
IdentityFile ~/.ssh/id_rsa
Host deploy
HostName bitbucket.org
IdentityFile ~/.ssh/deploy
In my bitbucket account, I set a SSH key for my account with the id_rsa
key, and then in my repo I set a SSH key with the deploy
key.
In command line, when I try to clone my repo as git clone git@deploy:<team_account_username>/<repo_name>
, I am asked to enter a password the first time, but not after that. Then I tried to clone my repo with Docker :
# Use anaconda docker image from ContinuumIO
FROM continuumio/anaconda
# Make ssh dir
RUN mkdir /root/.ssh/
# Copy over private key, and set permissions
ADD deploy /root/.ssh/deploy
ADD config /root/.ssh/config
RUN chmod 600 /root/.ssh/*
# Create known_hosts
RUN touch /root/.ssh/known_hosts
# Add bitbuckets key
RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts
# Clone git repos
RUN git clone git@deploy:<team_account_username>/<repo_name>
# Set default directory to execute CMD
WORKDIR /<repo_name>
# Run EART
CMD python app.py
and when the script tries to clone the repo, I've got
Permission denied (publickey)
fatal: The remote end hung up unexpecedly
[EDIT]
I tried to run those commands directly in the container, and as said in my comment, I am asked for the passphrase when I run the clone command, and that's where my script fails