- First, go to your cPanel and in the Search bar search Terminal.
- Open the Terminal
- Type: ssh-keygen -t rsa -b 4096 -C "username@example"
- Username defines your cPanel username and example defines your domain name.
- Hit Enter
- It crates your Private and Public keys
- To ensure that Type:cat ~/.ssh/id_rsa.pub
- If you succeed to generate then it shows you public key.
- Now Type:cat ~/.ssh/id_rsa
- It gives your Private key.
- Copy both your Public and Private keys to a text file for use in the future.
- Done for the server now time to configure GitHub repository.
- Create a new repository or use an existing repo to deploy in the cPanel. It would be better to make your repo is private.
- Click the repo and go to the settings tab.
- Now Click the add deploy key.
- Insert a name[key_name][it’s your choice] in the name input field.and also insert your public key in the key field and save it.
- Done in the Github.
- Now add some files in the Github repo.
- Now times to deploy your GitHub files in your cPanel.
- Go to your cPanel.
- Click Git™ Version Control
- Ensure that you have enabled your shall access.if not then contact your hosting provider.
- Click in the Create Button.
- Make sure Clone a Repository toggle is on.
- And now go to your GitHub repo and copy the SSH clone path. (Clone with SSH must be enabled/generally, it has https enabled)
- Copied URL paste in the cPanel Clone Url input field and give a location and also give a repo name.
- It creates a repo .and back to your repo section.
- Select your repo and click manage Button.
- Then click Pull or Deploy tab
- It gives all info about repo and also give the buttons to update your repo from GitHub(update from remote).
- Now go to your local computer directory and make .cpanel.yml file.
- And include the following codes:
---
deployment:
tasks:
- export DEPLOYPATH=/home/user/public_html/
- /bin/cp index.html $DEPLOYPATH
- /bin/cp style.css $DEPLOYPATH
- The user defines your cPanel username
- Save all files
- Commit and push now in the GitHub.
- Check whether it committed or not.
- Then if committed successfully then go to your cPanel.
- Click your Git™ Version Control
- Click your repo and click manage Button.
- Then go the Pull or Deploy tab
- Now click the update from remote Button
- After updating full repo from Github then click Deploy HEAD commit
- Check ur Public_html folder if successfully deployed then it shows your files.
- Now visit your website and see what happens.

Post a Comment
Leave a comment first....