Clone github repository on the shared host for Continuous Integration
First follow the article on Creating Github workflow using Github Actions and then you can use the following steps on setting up your repo on the shared host
This Article demonstrates how to set up a private repository on your local host. This allows the user to use cPanel as an automatic deployment location for their project that can run PHP, Ruby, Node.js™, or other desktop applications.
- This tutorial uses GitHub as an example host for a private repository. However, most of the steps in this tutorial are similar to the steps for any other private repository host.
- The steps in this tutorial require the Shell Access setting in cPanel & WHM version 70 or earlier or the Shell Access & Terminal setting in cPanel & WHM version 72 or later.
Because they require SSH access, you must perform additional steps in order to clone a privately-hosted remote repository.
This feature enforces several restrictions on clone URLs, and it verifies the remote host’s public SSH keys for
ssh://
clone URLs. For more information, read our Git Version Control documentation.If you do not perform these steps, you may see errors that resemble the following examples:
1 2
Error: (XID dugfmj) “/usr/local/cpanel/3rdparty/bin/git” reported error code “128” when it ended: fatal: could not read Username for 'https://github.com': No such device or address Error: “/usr/local/cpanel/3rdparty/bin/git” ended prematurely because it received the “TERM” (15) signal:
Set up access to private repositories
To set up access to private repositories, perform the following steps:
Generate an SSH key
If you have not already configured one, run the following command to generate an SSH key:
ssh-keygen -t rsa -b 4096 -C "username@example"
In this example, username
represents the cPanel account username and example
represents the domain name.
After you run this command, the system will prompt you to enter a passphrase. Do not enter a passphrase, and press Enter to continue.
Confirm that you generated the SSH key correctly
To confirm that the key exists and is in the correct location, run the following command:
cat ~/.ssh/id_rsa.pub
The output should resemble the following example, where AAAAB3Nza...
represents a valid SSH key:
ssh-rsa AAAAB3Nza...
Retain the full SSH key. Step 3 requires it.
If the output resembles the following example, ensure that you entered it correctly, and then run the command in Step 1 again:
cat: /home/username/.ssh/id_rsa.pub: No such file or directory
If the output resembles the following example, ensure that you ran the cat command with the correct path:
|
|
Register your SSH key with the private repository host
For information about how to register your SSH key with another private repository host, consult that host’s website or documentation. Some repository hosts, such as Bitbucket, do not allow you to configure write access for your access keys.
To register an SSH key with GitHub, perform the following steps:
Log in to your GitHub account.
Navigate to your private repository.
In the top right corner of the page, click Settings. A new page will appear.
In the left side menu, click Deploy keys. A new page will appear.
In the top right corner of the page, click Add deploy key. A new page will appear.
In the Title text box, enter a display name for the key.
In the Key text box, paste the entire SSH key.
If you want to push code from your cPanel account to your GitHub account, select the Allow write access checkbox.
Note:If you do not select this checkbox, you can only deploy changes from your GitHub repository to the cPanel-hosted repository.
Click Add key.
Test the SSH key
To test your SSH key, run the following command, where example.com
represents the private repository’s host:
ssh -T git@example.com
Clone the repository
To clone the repository, run the following command on the cPanel account, where git@example.com:MyStuff/private-repository.git
represents the private repository’s clone URL:
git clone git@example.com:MyStuff/private-repository.git
Comments
Post a Comment