Articles in this section

Unable to pull updates from Git repository in Plesk: Permission denied: Could not read from remote repository

kb: bug Plesk for Linux ABT: Group A

Applicable to:

  • Plesk for Linux

Symptoms

  • When trying to pull updates for a domain example.com from remote Git repository using SSH key authorization the following error is produced:

    PLESK_ERROR: Trying to pull the updates from git repository results in the error:
    Server at 'github.com' is seen for the first time. Adding its public key to the list of known hosts in '/var/www/vhosts/example.com/sub.example.com/.ssh/git_known_hosts'.
    # github.com:22 SSH-2.0-libssh_0.7.0
    # github.com:22 SSH-2.0-libssh_0.7.0
    # github.com:22 SSH-2.0-libssh_0.7.0
    Warning: Permanently added the RSA host key for IP address '203.0.113.2' to the list of 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.

  • The main system user's name was recently changed.

Cause

This is a Plesk bug with ID PPPM-7291, which is planned to be fixed in one of the future product updates.

Resolution

As a workaround, perform the following steps:

  1. Connect to the Plesk server via SSH.

  2. Place the SSH keys for authentication in the home directory of an additional FTP user from the error (e.g. content of /var/www/vhosts/example.com/.ssh/ directory to /var/www/vhosts/example.com/sub.example.com/.ssh/):

    # mkdir -p /var/www/vhosts/example.com/sub.example.com/.ssh/
    # cp -ap /var/www/vhosts/example.com/.ssh/* /var/www/vhosts/example.com/sub.example.com/.ssh/

  3. In case file is present, make sure that correct permissions are set:

    # chown jdoe:psacln /var/www/vhosts/example.com/sub.example.com/.ssh/id_rsa
    # chmod 600 /var/www/vhosts/example.com/sub.example.com/.ssh/*

    Where jdoe is the system user of the subscription.

Was this article helpful?

Comments

1 comment
Date Votes
  • Hello,

    I just had this problem with my Plesk servers when I was trying to sincronize my repository using the Plesk Git Module. As I use Bitbucket instead of Github and they've changed they keys on 20/06/2023 - https://bitbucket.org/blog/ssh-host-key-changes - i got this error message. I fixed it just by going to my .ssh folder and running:

    cd /var/www/vhosts/example.com/.ssh/
    mv git_known_hosts git_known_hosts.old

    After that, just click on the button "Pull now" and it's gonna work =)

    0

Please sign in to leave a comment.