This guide is for developers. If you just want to upload files, see Upload files with File Manager or FTP.
Step 1: Let your hosting read the repository
Public repository: skip this step. Private repository: your hosting needs an SSH key that your Git service trusts.1
Create a key in cPanel
Create an SSH key without a passphrase in SSH Access, and authorise it. See Use Terminal and SSH.
2
Add it to your Git service
Copy the public key and add it to your repository as a read-only deploy key, in your Git service’s repository settings.
Step 2: Clone the repository
1
Open Git Version Control
Log in to cPanel, type Git Version Control in the Search Tools box and open it. Click Create.
2
Enter the clone URL
Turn on cloning and paste the repository’s clone URL. Use the SSH form (
git@github.com:you/repo.git) for a private repository.3
Choose the folder
Enter a repository path, for example
repositories/mysite. Keep it outside public_html, so your Git files aren’t visible on the web.4
Create
Give it a name and click Create. cPanel clones the repository.
Step 3: Publish to your website
cPanel copies files to your website using a file called.cpanel.yml in the top folder of your repository. Add one like this, replacing cpanelusername with your cPanel username:
public folder to public_html. Change the folder names to match your project. Commit and push the file.
Update your site
1
Push your changes
Commit and push to your Git service as usual.
2
Pull them into your hosting
In Git Version Control, click Manage next to your repository, open the Pull or Deploy tab and click Update from Remote.
3
Deploy
Click Deploy HEAD Commit. cPanel runs the tasks in
.cpanel.yml.