Applicable to:
- Plesk for Linux
- Plesk for Windows
Symptoms
Unable to clone or pull updates from a remote Git repository (GitHub, Bitbucket, GitLab or others) to Plesk, one of the following errors might be displayed:
PLESK_ERROR: Cloning Git repository myproject.git...
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/.ssh/git_known_hosts'.
# github.com 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: The remote end hung up unexpectedly
PLESK_ERROR: Public key for the server at 'github.com' is already known in '/var/www/vhosts/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.
Cause
The remote Git repository (GitHub, Bitbucket, GitLab or others) does not exist or the SSH public key from the Plesk subscription account is not allowed on the remote Git repository.
Resolution
Allow the connection to the remote Git repository:
1- Copy the SSH public key from the Plesk subscription account:
Note: The following steps illustrate an example with a remote GitHub account but there is no difference with other Git repository providers such as Bitbucket, Gitlab and others.
-
Go to Domains > example.com > Git > Add Repository > Select: Remote Git hosting like GitHub or BitBucket > Set the Remote Git repository. For example, GitHub:
git@github.com:jdoe/myproject.git
or BitBucket:git@bitbucket.org:jdoe/myproject.git
-
Copy the SSH public key of the Plesk subscription account:
Note: The following steps illustrate an example with a remote GitHub account but there is no difference with other Git repository providers such as Bitbucket, Gitlab and others.
-
Go to Domains > example.com > Git
-
Click on the Repository Settings option:
-
Copy the SSH public key of the Plesk subscription account:
2- Allow the SSH public key from the Plesk subscription account on the remote Git repository:
Note: If the message Error: Key already in use
will be displayed on GitHub, verify that the SSH public key from the Plesk subscription account is not included on other GitHub repositories or accounts. For more details, check GitHub documentation.
-
In the upper-right corner of any page, click your profile photo, then click Settings:
-
In the user settings sidebar, click SSH and GPG keys:
-
Click on New SSH key:
-
In the Title field, add a descriptive label for the new key. For example, you might call this key:
Plesk SSH key
-
Paste the Plesk subscription SSH public key into the Key field:
-
Click Add SSH key:
-
If prompted, confirm your GitHub password:
-
If it's a new remote Git repository, go back to Plesk and continue the cloning process by clicking on OK to apply the changes:
Note: If the message Someone has already registered that SSH key
will be displayed on Bitbucket, verify that the SSH public key from the Plesk subscription account is not included on other Bitbucket repositories or accounts. For more details, check Bitbucket documentation.
-
In the lower-left corner, select your avatar and click on Personal settings > Click SSH keys > Click Add key
-
Enter a Label for the new key, for example, you might call this key:
Plesk SSH key
-
Paste the Plesk domain SSH public key into the Key field and click Save
-
If it's a new remote Git repository, go back to Plesk and continue the cloning process by clicking on OK to apply the changes:
Note: If the message Error: Key already in use
will be displayed on GitLab, verify that the SSH public key from the Plesk subscription account is not included on other GitLab repositories or accounts. For more details, check GitHub documentation.
-
Log in to GitLab
-
In the top right corner, select your avatar and click on Preferences
-
From the left sidebar, click on SSH Keys
-
In the Title text box, type a descriptive name for the SSH key, for example, you might call this key:
Plesk SSH key
-
In the Key text box, paste the Plesk subscription SSH public key and click on Add key
-
If it's a new remote Git repository, go back to Plesk and continue the cloning process by clicking on OK to apply the changes:
Comments
1 comment
Gracias, soluciono mi problema.
Please sign in to leave a comment.