How to Deploy an App from Github/Gitlab to cPanel

To connect to github so that you are able to clone the site, please follow these steps:

1. generate ssh keys

2. add the ssh keys to Github/Gitlab

3. create a repo

Detailed Steps

1. generate ssh keys

  • Login to your cPanel and go to Terminal under Advanced section.
  • Run the commands below in order to generate an ssh-key. Do NOT enter a passphrase. Simply click Enter button to avoid entering a passphrase
$ ssh-keygen
  • Once generated, type the command below to display the public key
$ cat .ssh/id_rsa.pub

A public key similar to this should be displayed

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCmjAq87u.............truehost.cloud

2. add the ssh keys to Github/Gitlab

The next step is to copy the key above to your Github account so that its allowed access. Use the guide below

https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account

If you use Gitlab, use the guide below instead

https://docs.gitlab.com/ee/user/ssh.html

3. create a repo

Now once done, copy your Clone URL from Github. Use the Clone with SSH option so that you get a URL similar to this

[email protected]:username/pythonapp.git
  • Login to cPanel and under Files section, click Git Version Control
  • Click Create button and fill in the form. A sample form is as below
  • Click Create.

Once done, your cPanel will be connected to your Github or Gitlab account and when you make changes to Github, all you need to do is click the Update from Remote button that will be available as shown below

Was this article helpful?

Related Articles

Leave A Comment?