Search code examples
bitbucketpleskpublic-key

Plesk Error: Public key for the server at 'bitbucket.org' is already known in '/var/www/vhosts/DOMAIN/.ssh/git_known_hosts'


My attempt:

ssh-keygen -f /var/www/vhosts/DOMAIN/.ssh/git_known_hosts -R bitbucket.org curl https://bitbucket.org/site/ssh >> /var/www/vhosts/buchungsformular.spar-mit.com/.ssh/git_known_hosts

But I still cannot clone my repository.

Some detailed error messages from plesk:

1.

Public key for the server at 'bitbucket.org' is already known in '/var/www/vhosts/DOMAIN/.ssh/git_known_hosts'. Warning: the ECDSA host key for 'bitbucket.org' differs from the key for the IP address 'xxx' Offending key for IP in /var/www/vhosts/DOMAIN/.ssh/git_known_hosts:1 Matching host key in /var/www/vhosts/DOMAIN/.ssh/git_known_hosts:8 Exiting, you have requested strict checking. Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

2.

do_known_hosts: hostkeys_foreach failed: Permission denied Server at 'bitbucket.org' is seen for the first time. Adding its public key to the list of known hosts in '/var/www/vhosts/DOMAIN/.ssh/git_known_hosts'. # bitbucket.org:22 SSH-2.0-conker_f1... 04.... # bitbucket.org:22 SSH-2.0-conker_... 5... # bitbucket.org:22 SSH-2.0-conker_f.... d... /usr/local/psa/admin/sbin/modules/git/git_ssh: line 49: /var/www/vhosts/DOMAIN/.ssh/git_known_hosts: Permission denied Failed to add public SSH host key for the 'bitbucket.org' into '/var/www/vhosts/DOMAIN/.ssh/git_known_hosts'. No ECDSA host key is known for bitbucket.org and you have requested strict checking. Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

3.

Public key for the server at 'bitbucket.org' is already known in '/var/www/vhosts/DOMAIN/.ssh/git_known_hosts'. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the RSA key sent by the remote host is SHA256:4...... Please contact your system administrator. Add correct host key in /var/www/vhosts/DOMAIN/.ssh/git_known_hosts to get rid of this message. Offending RSA key in /var/www/vhosts/DOMAIN/.ssh/git_known_hosts:1 remove with: ssh-keygen -f "/var/www/vhosts/DOMAIN/.ssh/git_known_hosts" -R bitbucket.org RSA host key for bitbucket.org has changed and you have requested strict checking. Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

Expected the repo to work again.


Solution

  • I needed to specify IdentifyFile .ssh/id_rsa and UserKnownHostsFile .ssh/git_known_host in the ~/.ssh/config file.