in my Dockefile, I add the ssh key to the docker and clone the project from the bitpack. I can easily extract another branch to the Docker file.
ARG key ARG pub_key RUN mkdir /root/.ssh/ RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts ADD $key /root/.ssh/ ADD $pub_key /root/.ssh/ RUN git clone git@bitbucket.org :******************/sql.git WORKDIR "/sql" RUN git pull origin testBranch
the repo is cloned with a sufficient degree of accuracy, and the attraction is successfully executed from testBranch when I launch this docker using the docker run and try any git command that says
Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights
but the ssh key is in the /root/.ssh directory
source share