1

I have read: BitBucket: Host key verification failed and Jenkins Host key verification failed and several other links provided. I seem to find myself in an odd situation.

I want to clone my django repo into a digital ocean droplet. I am following the steps of this document. https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04 .

Everything seems to have gone well, until the step where I need to create the django project. I already have a django project and thus don't want to create a new project on the server. I only need to clone it onto the server.

I ran : root@ubuntu-s-1vcpu-2gb-xxx:~#rsync --archive --chown=llewellyn:llewellyn ~/.ssh /home/llewellyn

My bitbucket has the id_rsa SSH key uploaded and it all worked in the past, no new SSH has been generated. And the repo is set to public.

When running:

(myprojectenv) llewellyn@ubuntu-s-1vcpu-2gb-xxx:~/myprojectdir$ git clone git@bitbucket.org:LlewellynHattinghLH/repo.git
Cloning into 'repo'...
Warning: Permanently added the RSA host key for IP address '18.205.xx.x' to the list of known hosts.
git@bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I have tried several articles, but most only tell me how to create a new SSH.

Any help would greatly be appreciated.

Llewellyn Hattingh
  • 306
  • 1
  • 5
  • 16
  • 3
    Have you verified that the target machine has the .ssh folder and that it and the content has the right permissions? Also, it would probably be simpler (and arguably more secure) to setup new ssh credentials, the same way you did on the first machine, than to copy them between machines. – fredrik Aug 23 '20 at 17:41
  • How will I check? Simply by running `ls` on the server, how would I check the permissions then? – Llewellyn Hattingh Aug 23 '20 at 17:58
  • 1
    `ls -l ~/.ssh` should do the trick - read the documentation on `ls` if you don't know how to read the result. – fredrik Aug 23 '20 at 19:28

1 Answers1

0

First, you can do:

export GIT_SSH_COMMAND='ssh -Tv'

Then the git clone will be more verbose, giving you more clues as to why it fails.

Second, regarding the permissions:

Your ~/.ssh must be 700, you keys 600: check that with ls -alrth ~/.ssh.
Note: what should be uploaded to your BitBucket is the id_rsa.pub public key, not the id_rsa private key.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250