-------------------------------
Putty:- https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
SSH Keygen command:-
ssh-keygen -t rsa -b 4096 -C "username@servername"
Subscribe
my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1
Facebook Page:- https://www.facebook.com/UnpossibleNS
Twitter Account:- https://twitter.com/UnpossiblePOG
Blog
:- https://unpossiblepog.blogspot.in/
-------------------------------
In this video, we shall make a connection between private github repository and live cpanel.
First you must have a domain with cpanel and a github account.
I purchased a domain+cpanel from godaddy. You can choose your own hosting providers but make sure that the SSH access is enabled. For godaddy users, here is the path to find and enable SSH access.
Next, open github, login into your account, or create account if you don’t have one.
Click on plus icon which is before your profile pic, click on new repository.
Give any random name.
You can make repository as private from here or if you forgot to make it private, you can make it afterward.
Just go to settings tab, scroll down, you will see, “Change repository visibility”, click on a button in front of it and can click on private and save it.
Now,
login into your domain’s cpanel.
Then
open PUTTY. If you don’t have it, download link is given in the
description. Install
it.
Now
copy the IP address from cpanel dashboard.
Paste
it in HOST NAME textbox, make sure that the SSH radio button is
selected, then click on OPEN.
It will open a command prompt.
Type the username which you use for login into cpanel.
Hit enter.
Now
type the cpanel’s login password.
When
you type the password, it will not show anything
on command prompt, but whatever
you are typing is
getting stored in the background.
Once you logged in, you will see something like this.
Once connected, you will have to type the command to create public and private key.
It will be given in the description.
In double quote, type username@servername.
Keep the filename & passphrase empty.
Now, go to cpanel and SSH ACCESS : MANAGE SSH KEYS.
You will see the newly created keys there.
Click on MANAGE of the public key, AUTHORIZE it.
Let’s jump to github, open your repository and click on settings tab, then DEPLOY KEYS. Then ADD DEPLOY KEY.
Give any key name.
For public key, go to cpanel, and click on VIEW/DOWNLOAD link in front of public key.
Copy
it from start to end and paste it in github’s key textarea.
Check
the ALLOW WRITE ACCESS, Of course we already can download files from
github to cpanel by default. But giving the WRITE ACCESS means, you
can upload changes from cpanel to github.
Once done, open the putty command prompt, type the following command to check if the domain can be connected to github or not.
Now we are successfully authenticated.
From
github, lets create a new file. Type
anything there. Give
it any random name.
Scroll
down and commit the change.
You will have a new file in your repository.
Go to cpanel dashboard, click on git version control, then CREATE.
Now open github, click on code, then click on SSH tab, copy the text from the textbox.
Paste it in CLONE URL textbox of cpanel.
For repository path, you can not add those folders which not empty.
For example if I add public_html folder which already has so many files and try to clone it, it will give me an error.
So you can either empty the public_html folder or create a new empty folder which is what I am going to do.
Now you can create a clone of private github repository.
You will be redirected to GIT repository listing. Click on the MANAGE button.
And click on PULL OR DEPLOY.
You will see that those UPDATE AND DEPLOY buttons are disabled.
First, lets check if our original file is copied to our website’s directory by going to the FILE MANAGER.
The file is there and it contains the text that we typed.
Let’s do some changes in github file and try to reflect it to our live site.
To synchronize or pull the changes, lets go to CPANEL’s dashboard : Git version control : MANAGE : PULL OR DEPLOY and click on UPDATE FROM REMOTE.
Lets
again go to file manager, and view
the file.
Changes
are reflected there.
So that is it, thanks for watching. Like share and subscribe.
No comments:
Post a Comment