git clone on server - host key verification failed
Asked by Mylene Kreiger:

Hi there :)

I'm trying to clone my repository to my server. Unfortunately I always get an error if I try.

Host key verification failed. - for ssh

fatal: could not read Password for '<https://myaccount@bitbucket.org>': Permission denied - for https

I don't get asked for my password which I have set in my account settings.

I have added the ssh key of my server to my personal settings as well. If I try to add an access key to the repository nothing is happening. The key won't be added and the modal doesn't close. I only have the free account, cant I add access keys with this account?

I would appreciate any help :D

Thanks, Mylene


Answers:
author: Theodora Boudale
body: Hi Mylene,

#### ++SSH++ {#toc-hId-201837354}

The 'Host key verification failed.' error shows when the public key fingerprints of Bitbucket are not in the known hosts file on your server (usually the first time you try to connect to Bitbucket via SSH from a machine).

If there is no prompt to add it to your known hosts, then you can do the following:

* Run the command **ssh-keyscan -t rsa bitbucket.org**
* Copy-paste the output in the **\~/.ssh/known_hosts** file on your machine and save it (or the known_hosts file in a different location if you keep a centrally located list of approved known hosts)

Reference: <https://support.atlassian.com/bitbucket-cloud/docs/configure-ssh-and-two-step-verification/>

After you do that, you can try cloning via SSH again, and please feel free to let me know how it goes.

If you have multiple SSH key pairs on that machine and you want to use a specific one for Bitbucket Cloud, I would also suggest adding the following in the **\~/.ssh/config** file to ensure that this key is being offered:

```
Host bitbucket.org
    HostName bitbucket.org
    User git
    IdentityFile ~/.ssh/private_ssh_key
    IdentitiesOnly yes
```

where **private_ssh_key** replace with the name of the private SSH key, whose public key you have uploaded to your Bitbucket account settings.

#### ++Access key to a repository++ {#toc-hId--1605617109}

Please keep in mind that access keys provide read-only access to a repo. You can use them to clone a repo, but not to push changes. What is your end goal? Do you want to use the SSH keys you added to your account or would you prefer to set up Access keys? Please keep in mind that an SSH key pair associated with your account provides access to all the repos your account has access to.

Regarding the issue you are reporting with adding an Access key: you should be able to add them regardless of the billing plan of your workspace.

The only way I can reproduce what you are reporting is if I try to enter an invalid key. Can you please confirm if you are indeed adding the public SSH key (instead of the private one), and also that you are copy-pasting the SSH key correctly?

#### ++HTTPS++ {#toc-hId-881895724}

It is possible that a credential helper is used on that machine that has an app password already stored. You can check that using the commands

```
git config --system credential.helper
git config --global credential.helper
```

Do you get output in any of them?

If there is no output, it would be useful to have the output of **git config --list** to check if there is any configuration that may affect the prompt for a password, and also let us know what version of Git you are using (you can find that with the **git --version** command).

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud