Child pages
  • Git Version Control
For cPanel & WHM version 74

Skip to end of metadata
Go to start of metadata

(cPanel >> Home >> Files >> Git™ Version Control)

Overview

The Git™ Version Control feature allows you to easily host Git repositories on your cPanel account. You 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). For more information, read our Guide to Git documentation and Git's documentation.

Notes:

  • 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.

    • For more information, read our Guide to Git - Host Git Repositories on a cPanel Account documentation.

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

  • 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.

In This Document

Related Documentation

For Hosting Providers

Repositories

Note:

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:

ColumnDescription
RepositoryThe 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. For more information, read our Gitweb documentation.
  • Delete — Click to delete the repository. A confirmation message will appear. Click Delete again to delete the repository.

    Warning:

    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:

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.

Click the expand icon () for a repository to view the following additional information and actions:

ItemDescription
Branch Information

Note:

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.

Create a repository

To create a new repository, perform the following steps:

  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.

      Important:

      • 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.
      • The system performs additional checks for clone URLs that use the ssh:// protocol. For more information, read the SSH host key verification section below.
    • 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. 

    Notes:

    • 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. For more information, read the Repository path restrictions section below.
  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.

SSH host key verification

If you entered an SSH clone URL, when you click Create, the system will automatically check for the remote server's public SSH host key. The system stores this key in the /home/user/.ssh/known_hosts file, where user represents your username. 

  • If the remote host is not registered with the system, click Save and Continue to add it to the file (register it). You can click Show Host Identification Information to view the host's algorithm and SHA-256 and MD5 fingerprints.
  • If the remote host is already registered, the system will create the repository.
  • If the remote host's public key has changed, the system will display a warning.
    • For third-party remote hosts, check for announcements about public key updates. Most companies that host repositories make announcements about these changes.
    • For remote hosts that you control, consider whether recent events on your system have caused changes to the public key, or contact your system administrator.

The system also performs this check and will request verification of altered host keys when you change repository information or update the repository.

Warning:

If you cannot verify the validity of a change, exercise caution, especially if your repository includes sensitive content. An altered SSH key may indicate a Man-in-the-Middle attack

Repository path restrictions

This feature enforces several restrictions for repository paths. 

The .git directory

Warning:

Do not modify or delete a repository's .git directory or its contents. Modifications to this data can irreparably break the repository.

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

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:

 Click to view...
  • .cpanel
  • .trash
  • etc
  • mail
  • ssl
  • tmp
  • logs
  • .cphorde
  • spamassassin
  • .htpasswds
  • var
  • cgi-bin
  • .ssh
  • perl5
  • access-logs


Manage repositories

Important:

You may see a message about a changed host key when you manage your repositories. For more information, read the SSH host key verification section above.

Click Manage to modify or deploy repositories. Click Basic Information to view repository information, or click Pull or Deploy to pull or deploy changes.

This section of the interface displays the following repository information:

ItemDescription
Repository Path

The repository's directory. Click to open the directory for the repository in cPanel's File Manager interface (cPanel >> Home >> Files >> File Manager) in a new browser tab.

Important:

You cannot modify the repository path for existing repositories.


Repository NameThe repository's display name. To modify this name, enter the new name and click Update.
Checked-Out Branch

The currently checked-out local branch. To check out a different branch, select the desired branch and click Update.

  • If you select a different branch, the system will automatically pull changes from the remote repository when it checks out that branch.
  • If the repository is a bare repository, the system will not display this information.
Currently Checked-Out Branch

The currently checked-out local branch. Click to open the Gitweb interface in a new browser tab.

  • If the repository is a bare repository, the system will not display this information.
  • For more information, read our Gitweb documentation.
HEAD Commit

Note:

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's HEAD commit (the most recent commit to the 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.

Click History to open the Gitweb interface in a new browser tab. For more information, read our Gitweb documentation.

Remote URLThe URL of the repository's remote repository.
Clone URLThe 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.

This section of the interface displays the following repository information:

ItemDescription
Repository Path

The repository's directory. Click to open the directory for the repository in cPanel's File Manager interface (cPanel >> Home >> Files >> File Manager) in a new browser tab.

Important:

You cannot modify the repository path for existing repositories.

Remote URLThe URL of the repository's remote repository.
Currently Checked-Out Branch

The currently checked-out local branch. Click to open the Gitweb interface in a new browser tab.

  • If the repository is a bare repository, the system will not display this information.
  • For more information, read our Gitweb documentation.
HEAD Commit

Note:

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's HEAD commit (the most recent commit to the 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.

Last Deployment Information

Note:

If you have never deployed this repository, the system will not display this information.

This section of the interface displays the following information about the most recent deployment of the repository:

  • Last Deployed on — The date of the deployment.

  • Last Deployed SHA — The SHA-1 value for the deployed commit.

  • Author — The deployed commit's author.

  • Commit Date — The date of the deployed commit.

  • The commit message for the deployed commit.

Update from Remote

Click to pull changes from the remote repository and apply them to the cPanel-managed copy of the repository. The system pulls changes with the --ff-only option and will only succeed if the branch's HEAD commit is up-to-date or Git can fast forward it.

Deploy HEAD Commit

Important:

We strongly recommend that you only deploy changes from a remote repository or a clone of it on your local computer. You should not directly change the cPanel-managed repository's contents. For more information about our suggested deployment configuration and how to set it up, read our Guide to Git - How to Set Up Deployment documentation.

Click to deploy changes from the cPanel-managed repository. Deployment requires a .cpanel.yml file and at least one local or remote branch.

  • The system runs the tasks that you configure in the .cpanel.yml file in order to deploy the repository.
  • We strongly recommend that you check the .cpanel.yml file in to your remote repository and not the cPanel-managed repository.
  • The system cannot deploy changes for repositories with dirty working trees.

For more information about deployment, read our Guide to Git - Deployment and Guide to Git - How to Set Up Deployment documentation.