Cloning a private Git repository through cPanel

Cloning a private repository into cPanel requires the hosting account to authenticate to the repository provider. Use a dedicated deployment credential with the minimum repository access required, and keep the repository separate from the public website root where practical.

What you need before you begin

Confirm Git Version Control and authorised shell access are available. Obtain the repository’s SSH clone URL and trusted host-key fingerprint. Plan a read-only deploy key when the hosting server only needs to pull code.

01 Clone a private Git repository through cPanel

  1. Generate a dedicated key for outbound repository access under the hosting account using the provider-supported procedure. Keep its private half protected on the server.
  2. Add only the public key to the repository provider’s deploy-key or equivalent access settings, limited to the intended repository.
  3. Configure the account’s SSH client to use that identity for the specific repository host. Preserve existing SSH configuration and avoid a wildcard identity rule that affects unrelated hosts.
  4. Open Git Version Control > Create, enable cloning, enter the verified SSH URL and choose an empty permitted repository directory.
  5. Verify any host-key prompt, create the clone and inspect the resulting branch and commit. Deploy through a separate reviewed process rather than assuming cloning publishes the site.

Confirm the expected result

The repository should contain the intended project and be able to fetch authorised changes without an interactive password prompt. Confirm no credentials or .git data are publicly downloadable.

Troubleshoot unexpected results

If cloning fails, test the outbound identity and repository permission separately from inbound hosting SSH access. Never embed a username-password pair in a clone URL or bypass an unexpected host-key change.

Why can I log into hosting but not clone?

These are different authentication directions. Your laptop authenticates to hosting for inbound SSH, while the hosting server needs its own authorised identity to read the private repository.

  • 0 Users Found This Useful
  • cpanel-whm, development
Was this answer helpful?

Related Articles

Uploading website files with cPanel File Manager

File Manager is useful for a small deployment or a single file change without installing an FTP...

Creating files and folders in cPanel File Manager

Create a folder to organise website assets or a file for a specific application task. An empty...

Editing a text file in cPanel File Manager

File Manager can make a focused change to a website text or configuration file. Saving writes...

Finding and editing .htaccess in cPanel

The .htaccess file can control redirects, access restrictions and application rewrite rules on...

Creating a restricted cPanel Web Disk account

Web Disk provides WebDAV access to server files. An additional Web Disk user can manage a...