Tuesday, December 13, 2016

Setting up a server based on GIT repository

GIT ( https://github.com/ ) now supports SSH and it is a fabulous way for administrators to keep their server machines updated with latest code from code repositories.





Present Scenario : Whenever you do a git pull using http mechanism, you have to share your credentials. When there are multiple developers/administrators (which is generally the case now), it is nightmarish doing this.

SSH Scenario : This mechanism allows you to have a machine level access instead of user level, which is an excellent way to keep and maintain code on a typical server infrastructure.

  1. Navigate to directory where you would like to clone git repository
  2. To generate a ssh certificate on your machine use the following command
    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  3. Add key information generated earlier to ssh-agent using below commands
            eval "$(ssh-agent -s)"
            ssh-add ~/.ssh/id_rsa
  4. Adding this new SSH key to your GitHub account
    Copy rsa by using command clip < ~/.ssh/id_rsa.pub
    Now navigate in browser to github account and click on Settings -> SSH and GPG keys.
    Paste the copied key in the new key section.
  5. From gitbash prompt add below command to fetch sources to local
    git clone "git@github****/.git"
    Be sure you use SSH url here and not the https.
  6.  and just do a git pull whenever you wish to pull the latest sources.

Note : I find Gitbash extremely convenient when using git on windows.





                                                    
You can download it from here GIT Download Windows



No comments:

Post a Comment

Merging and Splitting PDF files

We all use and rely on PDF's. There are occasions though when you want to edit certain portions of a pdf and merge the edited version ba...