Difference between revisions of "Setup git over SSH server"

From Notes_Wiki
m
m
 
Line 1: Line 1:
<yambe:breadcrumb self="Setup git over SSH server">Git|Git</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Versioning tools]] > [[Git|git]] > [[Setup git over SSH server]]
=Setup git over SSH server=


To setup git over SSH server use following steps:
To setup git over SSH server use following steps:
Line 37: Line 36:




<yambe:breadcrumb self="Setup git over SSH server">Git|Git</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Versioning tools]] > [[Git|git]] > [[Setup git over SSH server]]

Latest revision as of 15:42, 24 August 2022

Home > CentOS > CentOS 6.x > Versioning tools > git > Setup git over SSH server

To setup git over SSH server use following steps:

  1. First ensure that all users who are going to use the repository are in some user group.
  2. Ensure that all users of created group have SSH access to machine.
  3. Create a folder for storing git repository. Ideally folder should be located in common location such as '/opt/git' and not in some users home folder
  4. Initialize git repository by going into repository folder and using 'git --bare init --shared' command
  5. Change permisssion on repository folder using 'chgrp -R <group_name> <folder_name>'
  6. Now on users machine use following steps:
    1. Configure git name and email using:
      git config --global user.name "Your Name"
      git config --global user.email you@example.com
    2. Clone git repository at users machine using:
      git clone ssh://<ssh_username>@<machine_ip_or_name><git_repository_folder>
    3. Make changes to local repository using something like
      touch a.txt
      git add a.txt
      git commit -m "Added a.txt for testing"
    4. Push changes to repository using:
      git push origin master
    5. Pull changes from repository using:
      git pull origin master


If SSH access is provided only for git and it is desired that users should not be able to perform any other activity then one can use Restricting SSH access to a given command configuration.


Home > CentOS > CentOS 6.x > Versioning tools > git > Setup git over SSH server