Code The Pixel

Clone GitHub Private Repository from cPanel Using SSH

Asyraf Wahi Anuar - October 15, 2021
Published in Misc 2691 Views Email This Article
Estimated reading time: 1 minute, 24 seconds

The Git Version Control feature allows developers to easily host Git repositories on the developer cPanel account. The developer can use Git to maintain any set of files (for example, a website’s files and assets, a software development project, or simple text files). The Git version control is very useful for developers and it makes the process of repository cloning become easier and beginner-friendly. Visit cPanel Git Version Control for more information.

Requirement
SSH access
Putty

Install & Execute Putty
Download the latest Putty from their official website. Access your webserver through SSH using putty. 

hostname: CpanelLoginName@webserverIPAddress eg: [email protected]
port: 22 or you can contact your hosting provider


Generate SSH Key
generate the SSH key using the following command:

ssh-keygen -t rsa -b 4096 -C "username@servername"


Just press enter if SSH asked for the passphrase and it will generate the key. Next, navigate to your cPanel-SSH Access-Manage SSH Keys and authorize the generated key. 
Next, view and copy the SSH key value. The copied key will be used later.

Deploy SSH Key into Github Private Repo
Navigate to your GitHub private repository - Settings - Deploy keys - Add deploy key. Give the key title, and paste the copied SSH key. Don't forget to check the 'allow write access.

Next, in the Github private repo, go to the code tab, the click button and copy the clone SSH link. The clone SSH link will be used later. 

Clone The Private Repo via Cpanel
Navigate to Cpanel - Git Version Control - Create. Configure the required information. In the clone URL, paste the SSH link (copied from the GitHub repo). Cpanel will clone the private repo to the configured path.

That's all. Happy coding :)


Cite this article (APA 6th Edition)