Setup a Git server for local use

# On server side

Make sure you have install ssh server,

sudo apt install openssh-server

Create ‘git’ user

sudo adduser git

sudo passwd git

Create repository (remember to use git init --base on server side):

su - git

mkdir /home/git/sample-project.git

cd sample-project.git

git init --bare --shared

Create users to use git

sudo adduser user1

Add user to git group:

sudo usermod -a -G  git user1

# On local side (developer machine)

git clone ssh://<user name>@<server host or IP>/path/to/gitrepo

In this case assume that server IP address is, we should write:

git clone ssh://user1@

Now you can work on local. After that, commit and push to remote branch:

git commit -m 'A message'

git push origin master

Leave a Reply