Setup git over SSH server
From Notes_Wiki
Setup git over SSH server
To setup git over SSH server use following steps:
- First ensure that all users who are going to use the repository are in some user group.
- Ensure that all users of created group have SSH access to machine.
- 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
- Initialize git repository by going into repository folder and using 'git --bare init --shared' command
- Change permisssion on repository folder using 'chgrp -R <group_name> <folder_name>'
- Now on users machine use following steps:
- Configure git name and email using:
- git config --global user.name "Your Name"
- git config --global user.email you@example.com
- Clone git repository at users machine using:
- git clone ssh://<ssh_username>@<machine_ip_or_name><git_repository_folder>
- Make changes to local repository using something like
- touch a.txt
- git add a.txt
- git commit -m "Added a.txt for testing"
- Push changes to repository using:
- git push origin master
- Pull changes from repository using:
- git pull origin master
- Configure git name and email using: