Guide on How to Clone a GitHub cPanel Personal Repository

Dear cPanel Clone Private Repository GitHub

Make sure you already have a private repository on GitHub. In the GitHub public repository, the clone process is done in an easy and short way. But it's different if you are going to clone a private repository, where to do this requires additional steps and the SSH feature as a connection. Here is how to clone the complete GitHub private repository.


Step 1. Creating SSH Key

SSH Key creation on GitHub can only be done through the Terminal menu. This is because the SSH Access feature on cPanel is required to enter a passphrase, while GitHub does not yet support using a passphrase. The following are the steps taken:

1. Login to cPanel > access the Terminal menu.



2. Run the following command in the terminal. Replace "username" with your GitHub username.

ssh-keygen -t rsa -b 4096 -C "username@github.com"

3. After that you will be asked to enter a file name, in this example we save it in the .ssh folder and name it private_github

4. Next you will be asked to enter a passphrase. Make sure you don't fill in the passphrase because it can cause the Clone repository to fail. Clear it by pressing the enter button.

5. Wait for a while until you get the following display:


6. Check the SSH key that has been created previously by running the following command:

cat ~/.ssh/namaSSHkey.pu

Note: 

replace "nameSSHkey" with the file path created earlier

Copy the SSH Key that appears in the terminal to be added later on the GitHub side:


Step 2: Authorize SSH Key

1. Next, go to the cPanel File Manager > create a file with the name config in the .ssh folder.

2. Give the file permission 700.


3. Then edit the file and fill in the following script. Change "nameSSHkey" according to the ssh key name that was created in Step 1.

Host * IdentityFile ~/.ssh/namaSSHkey

Step 3. Adding SSH Keys to GitHub

1. In this step, please login to your GitHub account.

2. Log in to the private GitHub repository that will be cloned.

3. Klik Settings > Deploy Keys > Add deploy key.




4. Fill in "Title" with the key name. Enter the key from the cPanel ssh key that was copied earlier into the Key column. If so, click the Add key button.

Note: 

If you also want to be able to push from your cPanel account to the GitHub repository, you can check the "Allow write access" option.



Step 4. Clone Private Repository GitHub

After completing Step 3, you can then Clone Private Repository to cPanel.

1. Go back to cPanel > click the Git Version Control menu.




2. Go back to GitHub to retrieve the SSH Clone Private Repository GitHub address. Click the Copy button on the SSH address listed.




3. Click the Create button > Fill in all fields, make sure the Clone URL is filled in according to the SSH address as in the steps above.





4. Then wait for the clone process to finish. The larger the repo size, the longer the cloning process. Here is an example if the clone process has been completed:




Update and Deploy Repository

1. If the GitHub repository has recent activity updates, you can view them through cPanel. You can do this by clicking "Manage" on the repository > select the "Pull or Deploy" tab.

2. If there is a recent commit update and you want to update the repository in cPanel, please scroll down > click "Update From Remote" .



3. After that, the commit results from GitHub will be synchronized. For changes, you can directly check the specified cPanel repository folder.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.