I am using this method mentioned here to clone my Github repo to my httpdocs folder: Is it possible to connect to private Github repositories using Plesk Git extension?, but I am unable to connect. I always get the following error:
Public key for the server at ‘github.com’ is already known in ‘/var/www/vhosts/new.example.com/.ssh/git_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.
I am not using the standard SSH port but even if I switch to the default 22, I keep getting similar errors.
My firewall is accepting connections on my SSH port and I have added the public key on the SSH section on my Github account.
HTTPS is not an option because I am cloning a shared private repo.
I am using Centos 7 with Plesk Obsidian. Everything up to date.
I tried to use the same procedure on my Plesk Onyx server and it worked fine. Same firewall settings.
Any suggestions?
Thanks.
4
Answers
I managed to resolve it with the help of a support agent from Plesk (through teamviewer). I had to delete or rename the id_rsa, id_rsa.pub and known_hosts files from the .ssh folder and recopy the ssh key to my github account.
That error message generally appears when you already used the Plesk Git extension in some domain, so the solution is to have a different SSH public key for each domain you want to associate with a Git repo.
If you are in the Plesk panel, you should create a new subscription for that specific domain in order to get a new SSH public key generated by default in the Plesk Git extension.
Remember to add the public SSH key generated in you Github account.
You may try the following (solution for UBUNTU).
/etc/ssh# nano ssh_host_ed25519_key.pub
https://www.plesk.com/extensions/ssh-keys/
After changing domain name GIT cloning was no more working.
In my case the following file had to be updated:
the domain name was at the end of the long line: