Dev License: This installation of WHMCS is running under a Development License and is not authorized to be used for production use. Please report any cases of abuse to abuse@whmcs.com

How to Use Git Version Control in cPanel Print

  • 0

Set up and manage Git repositories directly in cPanel for version control of your website code and collaborative development.

What is Git Version Control?

Git is a distributed version control system that allows you to:
• Track changes to your code over time
• Collaborate with other developers
• Revert to previous versions when needed
• Branch and merge code for different features
• Maintain a complete history of your project

Benefits of Using Git in cPanel

  • Direct deployment: Push code changes directly to your website
  • Version history: Track all changes and revert if needed
  • Collaboration: Multiple developers can work on the same project
  • Backup: Git serves as a distributed backup system
  • Branching: Develop features in isolation
  • Integration: Connect with GitHub, GitLab, Bitbucket

Accessing Git in cPanel

1. Log into cPanel
2. Find "Git™ Version Control" in the Files section
3. Click on "Git™ Version Control"
4. View existing repositories or create new ones

Creating a New Git Repository

1. Click "Create Repository"
2. Configure repository settings:

Repository Settings:
Clone URL: Git repository URL (GitHub, GitLab, etc.)
Repository Path: Where to store the repository
Repository Name: Name for the repository
Branch: Which branch to clone (usually "main" or "master")

3. Click "Create" to clone the repository

Repository Management Options

Available Actions:
Pull/Deploy: Update repository with latest changes
Manage: View repository details and settings
Delete: Remove repository from cPanel
Browse: View repository files

Deploying Code Changes

Manual Deployment:
1. Go to Git Version Control
2. Find your repository
3. Click "Manage"
4. Click "Pull or Deploy"
5. Latest changes are deployed to your website

Automatic Deployment:
• Set up webhooks for automatic deployment
• Code changes trigger automatic updates
• Requires webhook configuration in your Git provider

Working with Branches

Branch Management:
1. In repository management, view available branches
2. Switch between branches as needed
3. Deploy different branches to different directories
4. Use branches for development, staging, production

Common Branch Workflow:
main/master: Production-ready code
develop: Integration branch for features
feature branches: Individual feature development
hotfix branches: Quick fixes for production issues

Git Repository Best Practices

  • Regular commits: Commit changes frequently with clear messages
  • Meaningful commit messages: Describe what changes were made
  • Branch strategy: Use branches for different features/environments
  • Regular pulls: Keep repository updated with latest changes
  • Backup: Ensure remote repositories are backed up
  • Access control: Manage who can access and modify repositories

Connecting to External Git Services

GitHub Integration:
1. Create repository on GitHub
2. Copy clone URL
3. Create repository in cPanel using GitHub URL
4. Set up SSH keys for authentication (if needed)

GitLab/Bitbucket:
• Similar process to GitHub
• Use appropriate clone URLs
• Configure authentication as required
• Set up webhooks for automatic deployment

SSH Key Management

Setting Up SSH Keys:
1. Generate SSH key pair in cPanel
2. Add public key to your Git service (GitHub, GitLab)
3. Use SSH URLs for repository cloning
4. More secure than HTTPS authentication

SSH Key Benefits:
• No password required for Git operations
• More secure authentication
• Required for private repositories
• Enables automated deployments

Repository File Management

File Operations:
• View repository files through cPanel interface
• Edit files directly (not recommended for production)
• Monitor file changes and history
• Compare different versions of files

Deployment Path Configuration:
• Deploy to public_html for live website
• Deploy to subdirectories for staging
• Use different paths for different branches
• Maintain separation between environments

Troubleshooting Git Issues

  • Clone fails: Check repository URL and authentication
  • Pull errors: Verify network connectivity and permissions
  • Authentication issues: Check SSH keys or credentials
  • Merge conflicts: Resolve conflicts in external Git client
  • Permission errors: Verify file permissions and ownership

Git Workflow Examples

Simple Website Deployment:
1. Develop website locally
2. Push changes to GitHub
3. Pull changes in cPanel
4. Website automatically updated

Team Development:
1. Multiple developers work on feature branches
2. Merge branches to develop branch
3. Deploy develop branch to staging
4. Merge to main and deploy to production

Security Considerations

  • Private repositories: Use for sensitive code
  • SSH keys: More secure than password authentication
  • Access control: Limit who can deploy to production
  • Environment separation: Keep development and production separate
  • Sensitive data: Never commit passwords or API keys

Limitations of cPanel Git

  • Basic interface: Limited compared to full Git clients
  • No commit creation: Cannot create commits through cPanel
  • Read-only operations: Mainly for pulling and deploying
  • Limited branching: Basic branch switching only
  • No merge resolution: Conflicts must be resolved externally

File Management and Backup Support

Our team provides comprehensive file management assistance:
• Automated backup solutions
• Large file transfer assistance
• Custom FTP configurations
• Git repository setup and management
• File organization and optimization

Contact support for personalized file management and backup solutions.


Was this answer helpful?

« Back

Powered by WHMCompleteSolution