Git is a distributed version control system used by many programmers. The cPanel Git Version Control tool provides a convenient graphical interface that allows access to Git features without using the command line.
You can use this tool to install and update a web site stored in a Git repository. This article shows how to install a simple 'Hello World!' example. You can follow the same steps to install an application of any size.
This article also shows how to clone a private Git repository.
In this example, a developer has created a web page and placed it in a repository on Github. To install the site from the Git repository, follow these steps:
If you are using the Paper Lantern theme, in the FILES section of the cPanel home page, click Git Version Control:
On the Git Version Control page, click
In the Clone URL text box, type the URL of the repository to clone. In this example, the site is being cloned from GitHub:
In the Repository Path text box, type the path to the document root of the site:
In the Repository Name text box, type a descriptive name for your repository:
Click
In the document root directory there is now the index.html file containing the 'Hello World!' message and a .git directory that contains files used by Git:
The site developer has created an 'About' page to supplement the 'Hello World!' message, and has added it to the Github repository. To update the site, follow these steps:
If you are using the Paper Lantern theme, in the FILES section of the cPanel home page, click Git Version Control:
Locate the hello-world repository, and then click
Click the Pull or Deploy tab:
Click
The new about.html page is now in the document root directory:
For public repositories, the previous procedures work as expected. However, if you try to clone a private repository using the procedure above, you receive an error message that resembles the following:
Error: (XID xna4yx) “/usr/local/cpanel/3rdparty/bin/git” reported error code “128” when it ended: fatal: could not read Username for 'https://github.com': No such device or address
To clone a private repository, you must use an SSH key pair and the SSH protocol in the clone URL. To do this, follow these steps:
ssh-keygen -t rsa
View the text of the public key:
cat ~/.ssh/id_rsa.pub
Add the SSH public key text to the Git provider you are using:
At the command line on your account, type one of the following commands to test the connection to the Git provider:
ssh -vT [email protected]
For GitLab, type the following command:
ssh -vT [email protected]
For Bitbucket, type the following command:
ssh -vT [email protected]
After you verify that the SSH connection is working, you are ready to clone the private repository using the ssh:// protocol. In cPanel, follow these steps:
If you are using the Paper Lantern theme, in the FILES section of the cPanel home page, click Git Version Control:
On the Git Version Control page, click
In the Repository Path text box, type the path to the document root of the site:
In the Repository Name text box, type a descriptive name for your repository:
Click
cPanel clones the private repository with the settings you specified. To update the repository, follow the steps in Updating the site above.
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.