How to use Git version control in cPanel Print

  • 0

cPanel's Git Version Control lets you keep a Git repository on your hosting and deploy code from it.

SSH access is needed for pushing and pulling from your computer (see How to connect via SSH).

Create or clone a repository

  1. In cPanel, open Git Version Control in the Files section.
  2. Click Create.
  3. To copy an existing repository, leave Clone a Repository on and paste its clone URL (for example from GitHub). For a new, empty repository, switch it off.
  4. Set the Repository Path (for example repositories/mysite) and a name.
  5. Click Create.

Private GitHub/GitLab repositories need an SSH deploy key: generate one in SSH Access and add the public key to your repository's deploy keys.

Deploying

Keep the repository outside public_html and add a .cpanel.yml file to your repository to tell cPanel which files to copy into public_html. Then use Manage › Pull or Deploy › Deploy HEAD Commit.


Was this answer helpful?

« Back