How to Use Git Version Control in cPanel Print

  • git, version control, cpanel, repository management, deployment, ssh, file versioning, web development
  • 0

Git Version Control in cPanel allows you to host and manage Git repositories directly from your hosting account. You can track changes to website files, manage code projects, or version control any set of files without needing external services. With cPanel's Git interface, you can create repositories, clone from remote sources, deploy changes automatically, and view repository history through an intuitive dashboard.

What is Git Version Control?

Git is a powerful version control system that tracks changes to your files over time. It allows you to maintain different versions of your projects, collaborate with others, and roll back changes when needed. When you use Git through cPanel, the system provides a web-based interface that simplifies repository management, making it accessible even if you're not comfortable with command-line tools.

The Git Version Control feature is particularly useful for website developers who want to maintain backups of their code, track modifications, and deploy updates smoothly. You can use it for WordPress sites, custom web applications, static websites, or any project that benefits from version tracking.

Accessing Git Version Control in cPanel

To access the Git Version Control interface in your OBHost cPanel account:

  1. Log into your cPanel account
  2. Navigate to the Files section
  3. Click on Git Version Control

From this interface, you can view all your repositories, create new ones, clone existing repositories, and manage deployment settings. The dashboard displays your repository name and its file path, making it easy to keep track of multiple projects.

Creating and Cloning Repositories

You can create a new Git repository or clone an existing one from a remote source. When creating a new repository, you'll specify a repository path on your server and a name for easy identification. The system automatically initializes the repository with the necessary Git structure.

When cloning a repository, you provide the clone URL from services like GitHub, GitLab, or Bitbucket. The system downloads all files and commit history to your hosting account. Note that cloning large repositories may take several minutes to complete, and the interface will display a progress message during this process.

Important: If you're cloning a private repository, you'll need SSH access to configure authentication keys. Without shell access, you can only work with public repositories through the cPanel interface.

Managing Repository Settings

Each repository in your list has a Manage button that opens detailed settings. Here you can:

  • Pull or Deploy Changes: Update your repository with the latest commits from the remote source
  • Configure Deployment Path: Specify where files should be deployed when you pull changes
  • View Repository Information: See the clone URL, branch information, and last update time

The system automatically adds a post-receive hook to all cPanel-managed repositories. This hook enables automatic deployment, meaning changes pulled from your remote repository can automatically update your live website files.

Using Git from Command Line

If your hosting account includes SSH access, you can perform advanced Git operations through the command line. While the cPanel interface handles basic tasks well, command-line access is required for:

  • Configuring SSH keys for private repository access
  • Working with multiple remote repositories
  • Performing complex Git operations like rebasing or cherry-picking
  • Executing custom Git hooks and scripts

You can access the command line through cPanel's Terminal interface (found under Advanced tools) or through an SSH client. This gives you full Git functionality while still benefiting from cPanel's automatic deployment features.

Viewing Repository History

The History button next to each repository opens Gitweb, a browser-based Git repository viewer. Through Gitweb, you can:

  • Browse repository files and folders
  • View commit history and messages
  • See who made specific changes and when
  • Compare different versions of files
  • Review branch structure

This visual interface makes it easy to understand your project's evolution without using command-line tools.

Removing Repository Management

If you no longer want cPanel to manage a specific repository, you can click the Remove button. This action stops cPanel from tracking the repository and removes it from the interface. However, the actual repository files remain on your server.

Important: Removing management does not delete your repository data. The files stay in their original location. If you want to completely delete a repository, you must manually remove the directory using cPanel's File Manager after removing cPanel management.

Understanding Repository Limitations

Keep these points in mind when working with Git in cPanel:

  • Only repositories created through the cPanel interface appear in the repository list
  • If you create repositories via command line, they won't show in the cPanel Git interface
  • Without SSH access, you can only create, clone, delete, and view repositories
  • Large repository clones may take significant time to complete

Frequently Asked Questions

Can I use Git Version Control without command-line experience?

Yes, the cPanel Git interface provides all essential features through a visual dashboard. You can create repositories, clone from remote sources, pull updates, and deploy changes without touching the command line. However, advanced operations like SSH key configuration for private repositories require command-line access.

What happens to my repository files when I click Remove?

Clicking Remove only stops cPanel from managing the repository. Your actual repository files and data remain intact in their directory. The repository disappears from the cPanel interface and you can no longer use cPanel's deployment features for it, but you can still access the files through File Manager or command line.

Why don't repositories I created via SSH appear in the cPanel interface?

The cPanel Git interface only displays repositories that were created through the cPanel Git Version Control feature. Repositories created directly via command line exist on your server but aren't tracked by cPanel's management system. To have them appear in the interface, you would need to recreate them using the cPanel tool.

How do I automatically deploy changes from my remote repository?

When you set up a repository in cPanel, you can configure a deployment path in the Manage settings. The system adds a post-receive hook that automatically copies files to your deployment location when you pull changes. This allows you to update your live website by simply clicking the Pull or Deploy button after pushing changes to your remote repository.

If you need assistance with Git Version Control or have questions about repository management, our support team is available 24/7. Visit our contact page or email support@obhost.org for help.


Was this answer helpful?

« Back