How to Connect a Private GitHub Repository to cPanel Git Version Control
Category: cPanel / Git / Website Development
Audience: cPanel Users, Website Developers
Applies to: cPanel hosting accounts with Git Version Control
Overview
cPanel provides Git Version Control, allowing you to connect your website to a GitHub repository and manage your website's code directly from your hosting account.
This guide explains how to connect a private GitHub repository to cPanel using a secure SSH Deploy Key.
This method is recommended when your GitHub repository is private and you want cPanel to securely clone and manage the repository.
What You Will Need
Before starting, make sure you have:
-
An active cPanel hosting account
-
A GitHub account
-
Access to the GitHub repository
-
Permission to add a Deploy Key to the GitHub repository
-
Access to cPanel → Git Version Control
You should also know the GitHub repository you want to deploy.
Example:
GitHub Repository:
[email protected]:yourcompany/your-project.git
Step 1 — Open cPanel Git Version Control
Log in to your cPanel account.
Go to:
cPanel → Files → Git Version Control
Click:
Create
This will open the repository creation form.
Step 2 — Generate an SSH Key in cPanel
If your cPanel account provides the SSH Access or Manage SSH Keys feature, you can generate an SSH key from:
cPanel → Security → SSH Access
Select:
Manage SSH Keys
Then click:
Generate a New Key
Use the following recommended settings:
Key Name
github_deploy
Key Type
RSA
or, if available:
ED25519
Passphrase
For automated Git deployments, the key normally needs to be available without an interactive passphrase.
If your hosting provider's Git deployment configuration requires an empty passphrase, leave this field blank.
Click:
Generate Key
Step 3 — Authorize the SSH Key
After generating the key, locate:
github_deploy
under Public Keys.
Click:
Manage
Then click:
Authorize
The key must be authorized before it can be used for SSH authentication.
Step 4 — Obtain the Public Key
Go back to:
SSH Access → Manage SSH Keys
Locate:
github_deploy
Under Public Keys, select:
View/Download
Copy the complete public key.
A public key normally looks similar to:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@server
or:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ... user@server
Important
Only copy the public key.
Never provide or publish your private key.
Step 5 — Add the Public Key to GitHub
Log in to GitHub and open the repository you want to connect.
Go to:
Repository → Settings → Deploy keys
Click:
Add deploy key
Enter a descriptive title.
For example:
cPanel Production Server
Paste the public key you copied from cPanel.
For normal website deployments, leave:
Allow write access
disabled.
This gives the cPanel server read-only access to the repository.
Click:
Add key
Step 6 — Obtain the GitHub SSH Repository URL
Open the GitHub repository.
Click:
Code
Select:
SSH
Copy the SSH repository URL.
Example:
[email protected]:yourcompany/your-project.git
Use the SSH URL
For private repositories, use:
[email protected]:yourcompany/your-project.git
Avoid using:
https://github.com/yourcompany/your-project.git
when following this SSH Deploy Key configuration.
Step 7 — Create the Repository in cPanel
Return to:
cPanel → Git Version Control → Create
Enable:
Clone a Repository
Clone URL
Paste the GitHub SSH URL.
Example:
[email protected]:yourcompany/your-project.git
Repository Path
Specify where cPanel should store the repository.
For example:
repositories/my-project
or:
public_html/my-project
depending on your website's deployment structure.
Important: Do not place the repository directly inside an existing directory containing unrelated website files unless you understand how Git will manage that directory.
Repository Name
Enter a descriptive name, for example:
my-project
Click:
Create
Step 8 — Wait for the Repository to Clone
cPanel may display a message similar to:
The system successfully initiated the clone process. The system may require more time to clone large remote repositories.
This is normal.
Once the process completes, the repository should appear under:
cPanel → Git Version Control
You should see information such as:
-
Repository name
-
Repository path
-
Branch
-
Remote URL
-
Repository status
Step 9 — Verify the Repository
Open:
cPanel → Git Version Control
Locate the repository you created.
Click:
Manage
Verify that the repository shows the expected:
Remote URL:
[email protected]:yourcompany/your-project.git
You can also use File Manager to confirm that the repository files were downloaded.
Step 10 — Configure Deployment
After the repository has been successfully cloned, cPanel can be configured to deploy changes from GitHub to your website.
Open:
cPanel → Git Version Control → Manage
Depending on your hosting configuration, you may see deployment-related options such as:
Deploy HEAD Commit
or deployment configuration options.
The exact deployment setup depends on your application.
For a simple PHP website, the repository can often be deployed directly to the website's document root.
For frameworks such as:
-
Laravel
-
Django
-
Node.js
-
Python applications
-
Other application frameworks
additional application configuration may be required.
Recommended Repository Structure
For a typical website, you may use:
/home/CPANEL_USERNAME/repositories/my-project
with the website deployed to:
/home/CPANEL_USERNAME/public_html
For example:
/home/exampleuser/
│
├── repositories/
│ └── my-project/
│ ├── .git/
│ ├── index.php
│ ├── assets/
│ └── ...
│
└── public_html/
Your developer or hosting administrator may recommend a different structure depending on the application.
Common Problems
"Could not read Username for https://github.com"
You may see an error similar to:
fatal: could not read Username for 'https://github.com':
No such device or address
Cause
The repository was configured using an HTTPS URL:
https://github.com/company/project.git
instead of the SSH URL.
Solution
Use:
[email protected]:company/project.git
and make sure the corresponding SSH public key has been added to the GitHub repository's Deploy keys.
"Permission denied (publickey)"
Example:
Permission denied (publickey).
Possible causes
-
The public key has not been added to GitHub.
-
The wrong public key was added.
-
The SSH key has not been authorized in cPanel.
-
The GitHub Deploy Key belongs to a different repository.
-
The repository URL is incorrect.
Check the following
-
Open the GitHub repository.
-
Go to Settings → Deploy keys.
-
Confirm that the correct public key is listed.
-
Confirm that the key belongs to the cPanel account.
-
Confirm that the repository URL is correct.
"Repository not found"
Example:
ERROR: Repository not found.
Check:
-
GitHub repository owner
-
Repository name
-
Repository spelling
-
Repository visibility
-
Deploy Key configuration
For example:
[email protected]:synqbox/odessee.git
must point to the correct GitHub repository.
Host Key Verification Error
You may encounter:
Host key verification failed.
If this occurs, contact your hosting provider's technical support team.
The hosting server may require additional SSH configuration for GitHub.
Security Recommendations
For private GitHub repositories:
1. Use Deploy Keys
A GitHub Deploy Key is dedicated to repository access.
2. Use Read-Only Access
For normal deployments, leave:
Allow write access
disabled.
The server generally only needs to download repository changes.
3. Never Share Your Private Key
Never provide the private SSH key to:
-
Support tickets
-
Public forums
-
Chat messages
-
Email
-
GitHub repositories
-
Website files
Only the public key should be added to GitHub.
4. Use Separate Keys Where Appropriate
For different production servers, projects, or hosting accounts, use separate SSH keys whenever practical.
This allows access to be revoked independently.
Quick Setup Checklist
Before creating the cPanel repository, confirm:
☐ cPanel account is active
☐ SSH key generated
☐ SSH key authorized in cPanel
☐ Public key copied
☐ Public key added to GitHub Deploy Keys
☐ GitHub repository is accessible
☐ GitHub SSH URL copied
☐ cPanel Git Version Control opened
☐ "Clone a Repository" selected
☐ SSH repository URL used
The GitHub URL should look like:
[email protected]:OWNER/REPOSITORY.git
After creation:
☐ Repository appears in Git Version Control
☐ Repository files are present
☐ Correct branch is selected
☐ Deployment configuration completed
Important Note for cPanel Users
If your hosting server uses a custom SSH port, you normally do not need to change anything on your cPanel account.
The hosting provider may already have the required GitHub SSH configuration in place.
If:
ssh -T [email protected]
or the cPanel Git Version Control process produces an SSH connection or host-key error, contact your hosting provider's technical support team rather than changing server SSH settings yourself.
Summary
The basic workflow is:
GitHub Private Repository
↓
Generate SSH Key
↓
Authorize SSH Key in cPanel
↓
Copy Public Key
↓
GitHub → Repository → Settings → Deploy Keys
↓
Add Public Key
↓
Copy GitHub SSH URL
↓
cPanel → Git Version Control
↓
Create / Clone Repository
↓
Deploy
Recommended GitHub URL format
[email protected]:OWNER/REPOSITORY.git
Using SSH Deploy Keys provides a secure way for cPanel to access a private GitHub repository without storing a GitHub username and password in your hosting account.