How To Use cPanel's Git Version Control In Your Dev Workflow

Having access to your perfect work environment regardless of where you are is very helpful for modern developers and is pretty much on everyone’s wishlist.

In modern-day development, maintaining a time-efficient workflow when coding, designing and managing web applications is very important.

Time is a key factor in productivity, and there are a lot of actions, clicks, and operations that we can either automate or even avoid to save ourselves time and keep staying focused and engaged with our workspace.

The Git™ Version Control feature located at cPanel >> Home >> Files >> Git™ Version Control allows you to easily host Git repositories on your cPanel account.

You can use Git to maintain any set of files (for example, a web site's files and assets, a software development project, or simple text files).

For more information, read Guide to Git documentation and Git's documentation.

Please note that:

  • If your cPanel account includes shell access, you can also use Git from the command line.
    • Without shell access, you can only create, clone, delete and view repositories.
    • You can use cPanel's Terminal interface (cPanel >> Home >> Advanced >> Terminal) to access the command line from within the cPanel interface.

  • You must use the command line to perform the following tasks:

    • SSH configuration in order to clone private repositories.
    • The use of multiple remote repositories. We recommend this use for advanced Git users only.
  • The system adds a post-receive hook to all cPanel-managed repositories. For more information, read Git's githooks documentation.

  • If you add or remove Git repositories via the command line, you may see an incorrect list of repositories in this interface. Currently, only repositories that you created in this interface will appear in the list.

Repositories

When you clone a repository, the system may require a large amount of time to complete.

The list of repositories will disable the options for the repository and will only display the repository name, repository path, and a message about the clone's progress.

The Repositories table lists the following information for all of your account's cPanel-managed Git repositories:
Column Description
Repository The repository's display name.
Repository Path The repository's directory.
 
    You can also perform the following actions:
  • Manage — Click to update the repository's cPanel-managed settings or pull or deploy changes.
  • History — Click to open the Gitweb interface in a new browser tab. Gitweb allows you to browse the repository and view its history and contents.
  • Delete — Click to delete the repository. A confirmation message will appear. Click Delete again to delete the repository.

    When you delete a repository, the system permanently deletes the entire contents of the repository's directory. You cannot recover this data after deletion.

Remember that when you clone a repository, the system may require a large amount of time to complete. The list of repositories will disable the options for the repository and will only display the repository name, repository path, and a message about the clone's progress.

Item Description
Branch Information If the repository does not include any commits for the current branch or is a bare repository, the system will not display this information.
    This section of the interface displays the following information about the active branch and its HEAD commit (the most recent commit to the branch):
  • Checked-out Branch — The currently checked-out remote or local branch.
  • Commit — The SHA-1 value for the HEAD commit.
  • Author — The HEAD commit's author.
  • Date — The date of the HEAD commit.
  • The commit message for the HEAD commit.
Repository Path The repository's directory. Click File Manager to open the directory for the repository in cPanel's File Manager interface (cPanel >> Home >> Files >> File Manager) in a new browser tab.
Clone URL The URL to use to clone the repository to another location (for example, your local computer, another cPanel account, or a GitHub account). Click Copy to copy this URL to your clipboard.

How To Create A Repository

  1. Click Create in the top-right corner of the interface. A new interface will appear.
  2. Select whether to clone an existing repository, create a new one, or add an existing one to the list of cPanel-managed repositories:
    • To clone an existing repository, ensure that the Clone a Repository toggle is enabled. Then, enter the clone URL for the repository that you wish to clone in the Clone URL text box.
      • this URL cannot contain a username-and-password pair.
      • this URL must include the http://, https://, ssh://, or git:// protocols or use the user@example.com/path format, where user represents the username, example.com represents the domain, and path represents the repository path.
      • you cannot enter a local repository path.
    • To create a new repository or add an existing repository to the list of cPanel-managed repositories, set the Clone a Repository toggle to disabled.
  3. In the Repository Path text box, enter the path to the directory that will contain the repository.
    • If the specified directory does not currently exist, the system will create it.
    • If the specified directory already contains a repository, the system will automatically add it to the list of cPanel-managed repositories.
    • You cannot use the . or .. directory references when you enter this path.
    • This feature enforces several restrictions on repository paths.
  4. In the Repository Name text box, enter the desired display name for the repository.
  5. To immediately create another repository, select the Create Another checkbox.
  6. Click Create, or click Return to Repository List to return to the list of repositories.
    • if you selected the Create Another checkbox, a success message will appear. Repeat these steps to create or clone additional repositories.
    • if you did not select the Create Another checkbox, a new interface will display a confirmation message and a list of helpful Git commands.

Repository Path Restrictions

This feature enforces several restrictions for repository paths.

.git directory

The system globally denies public access to repositories' .git directories.

Please do not modify or delete a repository's .git directory or its contents.

Modifications to this data can irreparably break the repository.

Character restrictions

You cannot create, delete, or view repositories with paths that include whitespace or any of the following characters:

		\ * | " ' < > & @ ` $ { } [ ] ( ) ; ? : = % #
	

cPanel-controlled directories

You cannot create, delete, or view repositories in the following directories:

  • .cpanel
  • .trash
  • etc
  • mail
  • ssl
  • tmp
  • logs
  • .cphorde
  • spamassassin
  • .htpasswds
  • var
  • cgi-bin
  • .ssh
  • perl5
  • access-logs
  • Softaculous, cPanel, Git
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How To View Your CPU Usage & Concurrent Connection In cPanel

When a customer hits limits, appropriate faults along with server processes snapshot are...

How To Manage Your File In cPanel With SFTP

First, ensure that you have installed an FTP client on your local machine before you download and...

How To Use SCP For cPanel File Management

SCP (Secure copy protocol) is a means based on the Secure Shell (SSH) protocol that you can use...

How To Locate Your cPanel Username & Password

In cPanel, cPanel users can access the cPanel interface via port:2083 or using a service domain...

What To Know About Changing Your cPanel Username

Can I change cPanel Username? We sometimes do get this question from some customers. Yes. You...