We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

Page tree
Skip to end of metadata
Go to start of metadata


Because they require SSH access, you must perform additional steps in order to clone a privately-hosted remote repository.


  • This tutorial uses GitHub as an example host for a private repository. However, most of the steps in this tutorial are similar to the steps for any other private repository host.
  • The steps in this tutorial require the Shell Access feature in cPanel & WHM version 70 or earlier or the Shell Access & Terminal setting in cPanel & WHM version 72 or later.
  • You can use cPanel's Terminal interface (cPanel >> Home >> Advanced >> Terminal) to access the command line from within the cPanel interface.
  • This feature enforces several restrictions on clone URLs, and it verifies the remote host's public SSH keys for ssh:// clone URLs. For more information, read our Git Version Control documentation.

Set up access to private repositories

Generate an SSH key.

If you have not already configured one, run the following command to generate an SSH key:

ssh-keygen -t rsa -b 4096 -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, and press Enter to continue.


Confirm 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_rsa.pub

The output should resemble the following example, where AAAAB3Nza... represents a valid SSH key:

ssh-rsa AAAAB3Nza...


Retain the full SSH key. Step 3 requires it.

If the output resembles the following example, ensure that you entered it correctly, and then run the command in Step 1 again:

cat: /home/username/.ssh/id_rsa.pub: No such file or directory

If the output resembles the following example, ensure that you ran the cat command with the correct path:




Register your SSH key with the private repository host.


  • For information about how to register your SSH key with another private repository host, 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:
    1. In the Title text box, enter a display name for the key.
    2. In the Key text box, paste the entire SSH key.
  7. If you want to push code from your cPanel account to your GitHub account, select the Allow write access checkbox.


    If you do not select this checkbox, you can only deploy changes from your GitHub repository to the cPanel-hosted repository.

  8. Click Add key.



Test the SSH key.

To test your SSH key, run the following command, where example.com represents the private repository's host:

ssh -T git@example.com



Clone the repository.

To clone the repository, run the following command on the cPanel account, where git@example.com:MyStuff/private-repository.git represents the private repository's clone URL:

git clone git@example.com:MyStuff/private-repository.git

Additional documentation

There is no content with the specified labels

Error rendering macro 'contentbylabel'

parameters should not be empty

There is no content with the specified labels