Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.3K
Visualizações
bitbucket docker Permission denied (publickey). fatal: Could not read from remote repository

I´m making a docker file with the following code:

# Update aptitude with new repo
RUN apt-get update

# Install software 
RUN apt-get install -y git
# Make ssh dir
RUN mkdir /root/.ssh/

# Copy over private key, and set permissions
ADD id_rsa /root/.ssh/id_rsa

# Create known_hosts
RUN touch /root/.ssh/known_hosts
# Add bitbuckets key
RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts

RUN chgrp 545 ~/.ssh/id_rsa
RUN chmod 600 ~/.ssh/id_rsa

# Clone the conf files into the docker container

RUN git clone git@bitbucket.org:xxxxxx/teste.git

RUN cd teste echo "# My project's README" >> README.md 
RUN git add README.md 
RUN git commit -m "Initial commit" 
RUN git push -u origin master

But when I build the file I got the following error:

Cloning into 'teste'... Warning: Permanently added the RSA host key for IP address 'xxx.xxx.xxx.x' 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. The command '/bin/sh -c git clone git@bitbucket.org:xxxxxxxx/teste.git' returned a non-zero code: 128

I generated id_rsa with PuTTY key gen and is already stored in bitbucket.

Anyone can help?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I believe that you need to add the corresponding private key in the container also. Since you mentioned that you generated the id_rsa key using putty, so that key is in your host machine.

What you need is to add the id_rsa key in your container and id_rsa.pub on bitbucket.

This post might help you more.

over 4 years ago · Santiago Trujillo Relatório

0

You have to add the public SSH key of the repository that's executing the command to the Access Keys section of the repository that you are trying to clone. I had the same issue.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda