Using git in shared platform, developer can deploy latest update easily to shared hosting.
If the repository is private, you need to do some extra work to deploy.
Before setting up git repository in server, you need to import passwordless SSH key to your server.
To generate SSH key run ssh-keygen -t rsa -b 4096 -f id_rsa
Press enter twice to generate passwordless key pair.
It will generate two file, id_rsa
and id_rsa.pub
Log in to cpanel and navigate to SSH Access under SECURITY category.
Now click to Manage SSH Keys button.
To import your generated SSH key, click on Import Key button.
Now copy the content of id_rsa
file generated before and paste it to the textbox labeled with, Paste the private key into the following text box:.
Now copy the content of id_rsa.pub
file generated before and paste it to the textbox labeled with, Paste the public key into the following text box:.
Leave the password field empty and click on Import button.
Now we need to tell GitHub about our public key.
Go to repository setting and navigate to Deploy keys section and click Add deploy key button to import your generated public key.
A for will appear, give this key a Title as you want and paste content of id_rsa.pub
file in key textbox.
Deploy keys always have pull access by default. If you like to push changes from your server, check Allow write access checkbox.
Click Add key button to add this key as deploy key.
Now your server can pull from this private repository.
To deploy your repository to your server. Go to cpanel and navigate to Gitβ’ Version Control under FILES category.
Click on Create button, copy SSH clone url from GitHub and paste it to Clone URL textbox.
Give a Repository Path where you want to clone the repository and Repository Name as you like.
Click on Create button to create the repository.
Your server will clone the repository to the Repository Path you have given during repository creation.
Have Fun π
Top comments (2)
Error: (XID psjyjh) β/usr/local/cpanel/3rdparty/bin/gitβ reported error code β128β when it ended: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
Facing above error
Check your SSH key