License Is Not Active.
We recommend that you use cPanel’s Git Version Control interface (cPanel » Home » Files » Git Version Control) to perform Git tasks. While many of these tasks require command-line access, this interface automates some parts of the process and allows you to view historical information for your repositories in Gitweb.
With the appropriate permissions, cPanel accounts can host Git repositories. Git’s version control software tracks changes in a system of files that multiple users can manage simultaneously. This tutorial uses the command line to create or clone a new Git repository, update the repository’s configuration, and clone the repository locally for updates.
For a list of common Git commands and their options, read our Common Git Commands documentation.
For information about how to deploy code from your hosted Git repositories, read our Deployment and Set Up Deployment Cron Jobs documentation.
For more information about Git, read Git’s documentation.
To perform the steps in this tutorial, you must meet the following requirements:
To clone private repositories, you must perform the additional steps in our Set Up Access to Private Repositories documentation.
You can create a Git repository in any existing directory, or you can create a new, empty directory for your repository. If your project already has a Git repository, you can clone the repository to your cPanel account instead.
To use cPanel’s Git Version Control interface (cPanel » Home » Files » Git Version Control) to manage your repository, you must ensure the repository and directory you place it into meet the following requirements:
You cannot include whitespace or the following characters in the repository name or directory path:
\\ \* | " ' < > & @ \` $ { } [ ] ( ) ; ? : = % #
The repository cannot be in the following cPanel-controlled directories:
|
|
If you use the command line to create a repository in a restricted path, the Git Version Control interface (cPanel » Home » Files » Git Version Control) will not display the repository.
To create a new repository, perform the following steps:
Use SSH to log in to your cPanel account on the command line.
To navigate to the directory that will contain your repository, run the following command, where :
cd ~/Project/example
To create a new directory to store your repository, run the following command and then navigate to that directory:
mkdir -p ~/Project/example
To initialize the directory as a Git repository, run the following command:
git init
To clone private repositories, you must perform additional steps. For more information, read our Set Up Access to Private Repositories documentation.
To clone an existing repository, perform the following steps:
Use SSH to log in to your cPanel account on the command line.
To navigate to the directory that will contain your repository, run the following command:
cd ~/Project
To create a new directory to store your repository, run the following command and then navigate to that directory:
mkdir -p ~/Project
To clone the repository, run the following command :
git clone https://domain.com/Account/example.git example.git
https://domain.com/Account/example.git
represents the repository’s clone URL.
Account
represents the GitHub account name and example
represents the repository name:
The system may require a large amount of time to clone larger repositories. Until this process finishes, HEAD information will be unavailable in cPanel’s Git Version Control interface (cPanel » Home » Files » Git Version Control).
cPanel’s Git Version Control interface (cPanel » Home » Files » Git Version Control) does not allow username-and-password pairs in remote repository URLs.
This optional step configures the Git repository to remain up to date as you push changes from the local branch.
For more information about Git’s configuration file and its options, read Git’s git-config documentation.
To update the configuration, run the following command from within the repository directory:
git config receive.denyCurrentBranch updateInstead
To clone the cPanel-account-hosted repository, access your local computer via the command line and run the following command:
git clone ssh://username@hostname/home/username/Project/example.git
username
represents the cPanel account username.
hostname
represents the hostname for the server that hosts your cPanel account.
After you finish this tutorial, you can make changes to the repository’s files on your local computer. You must run the following command in order to push changes that you make on your local computer to the hosted repository:
git push origin master -u
This command pushes your revisions to the copy of the repository that exists on your cPanel account.
cPanel & WHM’s Git installation will automatically configure some settings.
Copyright © 2004-2025 madRooster.com | Terms of Service | Privacy Policy