In This Document
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.
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:
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:
The output should resemble the following example, where
AAAAB3Nza... represents a valid SSH key:
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:
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:
- Log in to your GitHub account.
- Navigate to your private repository.
- In the top right corner of the page, click Settings. A new page will appear.
- In the left side menu, click Deploy keys. A new page will appear.
- In the top right corner of the page, click Add deploy key. A new page will appear.
- Enter your SSH key data:
- In the Title text box, enter a display name for the key.
- 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.
If you do not select this checkbox, you can only deploy changes from your GitHub repository to the cPanel-hosted repository.
- 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:
Clone the repository.
To clone the repository, run the following command on the cPanel account, where
firstname.lastname@example.org:MyStuff/private-repository.git represents the private repository's clone URL: