gitgithubsshssh-keysnamecheap

Github Private Repo connection issue on cPanel


How can I solve the issue in order to add a github private repository on namecheap cpanel shared hosting

ERROR: You're using an RSA key with SHA-1, which is no longer allowed. Please use a newer client or a different key type.


Solution

  • cPanel haven't supported the RSA SHA-2 fingerprint SSH required by GitHub yet so its best you use the ECDSA ssh type to connect to the private repository. Firstly, delete the previous rsa key generated, then follow the process below:

    1. Generate An SSH Key

    ssh-keygen -t ecdsa -b 521 -C "username@example"

    In this example, "username" represents the cPanel account username and "example" represents the domain name.

    After you run this command, the system will prompt you to enter a passphrase.

    Do not enter a passphrase.

    Press Enter to continue.

    2. Verify That You Generated The Ssh Key Correctly

    To confirm that the key exists and is in the correct location, run the following command:

    cat ~/.ssh/id_ecdsa.pub

    3. Register Your SSH Key With The Private Repository Host

    For information about how to register your SSH key with another private repository host (Bitbucket, GitLab, etc), consult that host's website or documentation.

    Some repository hosts, such as Bitbucket, do not allow you to configure write access for your access keys.

    To register an SSH key with GitHub, perform the following steps:

    1. Log in to your GitHub account.
    2. Navigate to your private repository.
    3. In the top right corner of the page, click Settings. A new page will appear.
    4. In the left side menu, click Deploy keys. A new page will appear.
    5. In the top right corner of the page, click Add deploy key. A new page will appear.
    6. Enter your SSH key data:
    7. In the Title text box, enter a display name for the key.
    8. In the Key text box, paste the entire SSH key. If you want to push code from your cPanel account to your GitHub account, select the "Allow write access" checkbox. Do note that if you do not select this checkbox, you can only deploy changes from your GitHub repository to the cPanel-hosted repository.
    9. Click Add key.

    4. Test Out The SSH Key

    To test your SSH key, run the following command.

    ssh -T git@example.com

    where example.com represents the private repository's host - e.g ssh -T git@github.com.

    5. Clone The Private Repo

    Go to the Git Version Control in your cPanel and clone your repository there.

    Reference: - https://dashboard.webhostingmagic.com/knowledgebase/242/How-To-Clone-A-Private-Github-Repo-To-A-cPanel-Server.html