When trying to clone GIT repository in Plesk (by using its GIT interface) from bitbucket.org you may face the following error:
Deploying files to [website.tld]
Cloning into bare repository '/var/www/vhosts/[website.tld]/git/[repository_name].git'...
Server at 'bitbucket.org' is seen for the first time.
Adding its public key to the list of known hosts in '/var/www/vhosts/[website.tld]/.ssh/git_known_hosts'.
write (bitbucket.org): No route to host
write (bitbucket.org): No route to host
write (bitbucket.org): No route to host
Failed to gather public SSH host key for the 'bitbucket.org'.
Known hosts file '/var/www/vhosts/[website.tld]/.ssh/git_known_hosts' doesn't exist
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
This can be fixed easily in a following way:
- Use the Plesk File Manager or connect via SFTP to your webspace and navigate to /.ssh/ directory (just outside of /httpdocs/ directory)
- If you do not see a file there named “git_known_hosts“, create it and save with permissions “0600”..
- Ensure that the “git_known_hosts” file has also a proper owner and group assigned (Set the owner as the username of your webspace. Group should always be “psacln“)
- Open this page on Bitbucket and copy its contents: https://bitbucket.org/site/ssh
- Open the “git_known_hosts” file (the one you created or checked earlier) and append the copied contents to it – then save the changes afterwards.
Now you should be able to sucessfully clone the GIT repository.