Mostly We can create Github repositories as public and private. For public repositories, the git cloning will go smooth. But for Private projects we have to do some terminal operations to generate ssh keys for doing it.
STEPS
1) In Your Cpanel You should be having a Terminal Access. Make sure you have , talk with your server administrators for having it. You can create ssh key through interface also, but for this case, you will be needing the terminal.
2) In the Terminal , Just type like this:-
ssh-keygen -t rsa -b 4096 -C "username@domain.com"
Make sure the bit is 4096. and username you can replace it with your cpanel username and domain.com, replace it with your domain name.
3)After you run this command, the system will prompt you to enter a passphrase. Do not enter a passphrase, and press Enter to continue.
4)Now key will be generated in the system. so Inorder to make sure that, its generated. run this:-
cat ~/.ssh/id_rsa.pub
5) Now you will get an output like:-
ssh-rsa AAAAB3Nzawhdejsfdjhfgdjgfhjfdghjfhgjhjfdhgdfjhgjudfhgjikgfhgfhgfhfghhgfhgfhgfhgfhhgfhasftfgegdggdgdgd...
Copy this and store it somehere. These is your key.
6) Now we have to register key in Github. For that go to the repository.click settings. and click on Deploy Keys menu.
7) You will see an Add Deploy Key option like this:-
8)After, clicking you will get a form like this:-
8)In the Title text box, enter a display name for the key.
9)In the Key text box, paste the entire SSH key.
10) If you want to push code from your cPanel account to your GitHub account, select the Allow write access checkbox.
11) Now in your cpanel, Go to GIT version control page.
12) In the page coming, click on create button shown on the right side:-
13) Now a create page will come like this:-
In Clone URL, enter the SSH details instead of https. That you can get from :-
repository path you can set to the domain directory u want to clone. and give a repository name for identification. Then click on create. Your repository will be successfuly created.
14) Now you can manage, the repository by visiting the git list.
After syncing..may be sometimes you dont want the connection setting files to upload everytime.. so after adding files to gitignore you can perform a command like:-
git rm -r --cached . && git add . && git commit -am "Remove ignored files"
or step by step
git rm -r --cached .
git add .
git commit -am "Remove ignored files"
Enjoy Coding :-)
Thanks admin for the post, Its really a nice post and Looking for more blogs like this. Please stay updated..!
ReplyDeleteEcommerce Website Aberdeenshire