Git Version Control: Hosting and Managing Repositories in cPanel
With Git Version Control in cPanel, you can create, clone, and manage Git repositories directly in your hosting account. Git is excellent for organizing changes to website files, templates, themes, assets, or software projects in a traceable way. Instead of manually overwriting files, you work with versions, commits, and branches.
For developers, agencies, and advanced website operators, Git is an essential component of a clean workflow. Changes can be prepared and tested locally and then systematically transferred to the server. This helps you keep a better overview of which files were changed, when, and why.
The Git feature in cPanel is particularly useful if you want to clone an existing project from a platform like GitHub, GitLab, or Bitbucket to your hosting account, or if you want to create a new repository directly on the server. Depending on your hosting configuration, you can also use deployments to transfer files to a target directory in a controlled manner.

Without shell or SSH access, Git usage in cPanel is limited. You can create, clone, view, and remove repositories via the interface. For private repositories, SSH keys, multiple remote repositories, or more complex Git commands, shell/terminal access is usually required.
What is Git and why is it useful?
Git is a version control system. It does not just save files, but documents changes to the project history. Every change can be saved as a so-called commit. This makes it possible to understand later which files were changed, when the change occurred, and what description was provided for it.
Git is especially helpful when:
- multiple people are working on a project,
- changes need to be traceably documented,
- new features need to be tested first,
- a secure deployment process is desired,
- code should no longer be "blindly" overwritten via FTP,
- a website is maintained directly from a repository.
Particularly for professional websites, Git is a major advantage. Instead of uploading individual files manually via FTP, changes can be applied in a controlled manner. This reduces errors and makes development more traceable in the long run.
What can the Git feature in cPanel do?
Git Version Control in cPanel provides a graphical interface for basic repository tasks. You can use it to create repositories, clone existing repositories, view cPanel-managed repositories, and perform specific management actions.
Typical features include:
- creating new Git repositories in the hosting account,
- cloning existing repositories from external sources,
- adding existing local Git repositories to cPanel management,
- viewing repository information in an overview,
- selecting or managing branches, as far as supported by the interface,
- fetching or deploying changes, if configured,
- viewing the history via Gitweb,
- removing repositories from cPanel management.
However, the cPanel interface does not replace all command-line Git functions. For advanced tasks such as complex branch strategies, merge conflicts, SSH key configuration, multiple remotes, or custom Git hooks, you will normally need the command line.
Create a repository or clone a repository?
When setting up a Git repository in cPanel, there are generally two typical paths: you either create a new repository directly in the hosting account or you clone an already existing repository from an external platform.
Clone Repository
You copy an existing Git project from an external source to your hosting account. This is useful if your project is already hosted on GitHub, GitLab, Bitbucket, or another Git server.
Requires a valid clone URL, for example via HTTPS or SSH.
Create New Repository
You create a new Git repository in a folder of your hosting account. This is useful if a new project is to begin directly on the server or if an existing folder is to be versioned in the future.
The target directory must be suitable and, depending on the situation, must not already be occupied by incompatible files.
Setting up a new Git repository in cPanel
The exact names of the fields may vary slightly depending on the cPanel version and language. However, the basic process remains similar.
Step-by-Step Instructions
- Log in to cPanel.
- In the Files section, open the Git Version Control feature.
- Click on Create.
- Decide whether you want to clone an existing repository or create a new one.
- If cloning, enter the clone URL of the external repository.
- Set the repository path, which is the directory where the repository should be stored.
- Assign a meaningful display name.
- Review all details carefully.
- Click on Create to set up the repository.
If you are cloning an external repository, the process may take some time depending on the size of the project. During this time, certain actions in the interface may be temporarily unavailable.
Clone URL: HTTPS or SSH?
When cloning an external repository, you need a clone URL. This can look different depending on the platform and type of access.
| Type | Example | Note |
|---|---|---|
| HTTPS | https://example.com/user/repo.git |
Often simple for public repositories. Private repositories require additional credentials or tokens. |
| SSH | git@example.com:user/repo.git |
Frequently useful for private repositories, but requires correctly configured SSH keys. |
| git:// | git://example.com/user/repo.git |
Not recommended for confidential or private projects. |
cPanel allows certain formats for clone URLs, including URLs with http://, https://, ssh://, git://, or SSH-like formats such as user@example.com:path. Credentials should not be stored directly as a username-password combination in the URL.
Private repositories require additional authentication. In many cases, SSH access and a correctly added SSH key configuration are necessary for this. If a private repository cannot be cloned, the cause is often missing or incorrectly configured SSH keys.
Choosing the right repository path
The repository path determines where the Git repository will be stored in your hosting account. This path should be chosen deliberately. Not every folder is suitable, and certain system directories are locked for cPanel-managed repositories.
Suitable examples can include:
/home/user/repositories/my-project/home/user/git/my-theme/home/user/public_html/project, if the repository is intentionally intended to be located directly in the web directory
For production websites, it is often cleaner not to use the actual repository directly as a public web directory, but to set up a separate deployment into the desired target directory. This prevents development files, configuration files, or unneeded project files from becoming publicly accessible.
Path restrictions and forbidden characters
cPanel imposes restrictions on repository paths to protect system areas and avoid technical issues. Repositories cannot be created in certain cPanel-controlled directories. These include directories such as .cpanel, .ssh, .trash, etc, logs, mail, ssl, tmp, or similar system areas. Certain special characters are also not allowed in repository paths.
| System folders | Do not create repositories in cPanel-controlled folders like .cpanel, .ssh, mail, ssl, tmp, or similar system directories. |
| Special characters | Avoid spaces and special characters in paths. Use clear names with lowercase letters, numbers, and hyphens. |
| Empty target folders | When a new repository is created, the target directory should be empty or properly prepared. Already existing files can cause conflicts. |
A clean repository path could be, for example, git/my-project or repositories/client-website. Avoid names like My Project 2026! or paths containing special characters.
Managing the repository: Manage, History, and Remove
After creating or cloning a repository, it appears in the cPanel overview. Depending on the cPanel version and repository status, various actions are available there.
- Manage: Opens the repository settings. Here you can review cPanel-managed settings, pull changes, or execute a deployment if it has been set up.
- History: Opens the Gitweb view. There you can view commits, files, and the project history in your browser.
- Remove: Removes the repository from cPanel management. This disconnects cPanel management; according to cPanel documentation, the repository data in the directory is not automatically deleted by this action.
Removing a repository from the cPanel Git interface is not the same as completely deleting all project files. If you actually want to delete the files, they must be removed separately. Carefully check whether you need a backup before any deletion process.
Deployment with Git in cPanel
A repository alone does not automatically mean that your website is updated live. During a deployment, files from the repository are transferred to or updated in a target directory. In cPanel, a deployment can be done manually via the interface or via Git hooks, depending on the setup.
For cPanel deployments, a file named .cpanel.yml is frequently used. This file describes which actions should be executed during deployment, for example, copying specific files to a target directory.
A simplified example can look like this:
---
deployment:
tasks:
- export DEPLOYPATH=/home/user/public_html/
- /bin/cp -R * $DEPLOYPATH
This example is for illustration purposes only. The path /home/user/public_html/ must be adapted to your actual hosting account. Furthermore, not every project should be deployed across the board with cp -R *, as this could also copy files that should not be publicly accessible.
Only deploy files that are actually intended to be publicly accessible. Development files, credentials, local configurations, build files, or documentations do not automatically belong in the web directory.
The .git directory and security
A Git repository contains an internal directory named .git. This contains the project's version history. This directory is technically important and must not be manually modified or deleted.
cPanel takes protective measures to ensure that the .git directory is not publicly accessible via the browser for cPanel-managed repositories. Nevertheless, you should be careful with production websites if repositories are located directly in the web directory. A clean separation of repository and deployment target is often the more secure structure.
Never manually modify or delete content within the
.git folder. This can damage the version history and render the repository unusable.Recommended workflow for websites
A clean Git workflow helps avoid errors and makes changes traceable. For many websites, the following process is suitable:
- Develop and test changes locally on your computer.
- Save changes with meaningful Git commits.
- Push the changes to a central repository, for example on GitHub, GitLab, or Bitbucket.
- Clone or update the repository in cPanel.
- Execute a controlled deployment into the desired web directory.
- Test the website in the browser after deployment.
- In case of problems, check the Git history and the most recently deployed changes.
This process is significantly safer than spontaneous changes directly on the live server. Especially for client projects, shops, or production websites, changes should be as traceable and reproducible as possible.
Git and WordPress: What makes sense?
Git can also be useful for WordPress projects, but should be used deliberately. WordPress consists of files and a database. Git versions files, not automatically database content like posts, pages, settings, or orders.
For WordPress, Git is suitable, for example, for:
- custom themes,
- custom plugins,
- child themes,
- configuration files without sensitive credentials,
- project files for development and deployment.
It is generally not sensible to fully version the entire wp-content/uploads folder with large media files or cache directories. Such content can unnecessarily bloat a repository.
What does not belong in a Git repository?
Not every file should be stored in Git. Particularly sensitive or automatically generated files should be excluded.
- Credentials and passwords
.envfiles with confidential settings- Cache directories
- Temporary files
- Large upload or media files, unless they are intentionally meant to be versioned
- Local development files
- Backups and ZIP archives
- Generated dependencies, if they are reproducible via package managers
A file named .gitignore is typically used for this purpose. In this file, you define which files or folders Git should ignore.
# Example of a simple .gitignore
.env
*.log
cache/
tmp/
node_modules/
vendor/
*.zip
Which entries make sense depends on the project. Typical exclusions differ for PHP, Node.js, WordPress, or static websites.
Common problems with Git in cPanel
| Problem | Possible Cause | Solution |
|---|---|---|
| Repository cannot be cloned | Incorrect clone URL, private repository, missing SSH keys, or access denied. | Check clone URL, test access, verify SSH key configuration. |
| Repository does not appear in cPanel | Repository was created via the command line or is located in an unsupported path. | Add repository via cPanel or check path restrictions. |
| Deployment copies incorrect files | Faulty .cpanel.yml or too broadly defined copy rules. |
Check deployment file and specify target paths exactly. |
| Private repository connection fails | SSH key is missing, incorrect key added, or host key not confirmed. | Verify SSH access and key configuration. |
| Website shows error after deployment | Incomplete deployment, incorrect branch, missing dependencies, or faulty code. | Check last commit, verify branch, test logs and application. |
Best Practices for Git Repositories in Web Hosting
- Use clear repository names without special characters.
- Avoid placing repositories directly in sensitive system folders if possible.
- Separate the repository from the public web directory if a deployment process is possible.
- Do not store passwords, API keys, or credentials in the repository.
- Use an appropriate
.gitignorefile. - Document changes with meaningful commit messages.
- Test deployments after every change.
- Never manually modify the
.gitfolder. - Use private repositories for confidential projects.
- Carefully verify SSH and access permissions for external repositories.
FAQ on Git Version Control in cPanel
Can I use Git in cPanel without SSH?
Yes, with limitations. You can create, clone, view, and remove repositories via the cPanel interface. However, shell/SSH access is typically required for private repositories, SSH keys, multiple remote repositories, or more complex Git commands.
Can I clone a private GitHub repository?
Yes, in principle this is possible, but it requires additional authentication. Frequently, an SSH key configuration is needed for this. Without correctly configured keys, access to private repositories usually fails.
Will my website update automatically when I clone a repository?
No, not automatically in every case. A cloned repository initially resides in a directory of your hosting account. For changes to appear live on the website, the repository must either be located directly in the web directory or a deployment to the web directory must be set up.
What is Gitweb?
Gitweb is a browser view that allows you to view the history, commits, and contents of a repository. It is used for overview and analysis but does not replace a full development environment.
What happens when I remove a repository from cPanel?
The repository is removed from cPanel management and no longer appears in the Git interface. According to cPanel documentation, the files in the repository directory are not automatically deleted. If you want to remove the data completely, you must delete it separately.
Should I place my repository directly in public_html?
This is technically possible, but not always recommended. For many projects, it is safer to store the repository outside the public web directory and only deploy the required files to public_html in a targeted manner.
Can Git version my database?
No. Git versions files. Database contents such as WordPress posts, shop orders, or CMS settings are not automatically versioned by it. Separate backup or migration strategies are required for this.
Git Version Control in cPanel makes it possible to create, clone, and manage repositories directly in the hosting account. Git is particularly suitable for professional website workflows, traceable changes, and controlled deployments. For private repositories, SSH keys, and complex Git work, shell/SSH access is frequently required. Pay special attention to secure repository paths, a clean
.gitignore, and ensuring that no confidential data is stored in the repository.If you want to clone a repository, set up SSH keys, or prepare a secure deployment for your website, CURIAWEB support will be happy to assist you.
Create a support request