1. add new user
useradd git passwd git
2. config the ssh login with key file
ssh-genkey -t rsa
then save the generated id_rsa.pub to server/home/git/.ssh/authorized_keys
3. make git repository
in /home/git
mkdir admin (optional) git init --bare test.git
4. git clone the repository
git clone git@domain.com:admin/test.git
or (if didn’t make the admin dir)
git clone git@domain.com:test.git
ref: https://www.digitalocean.com/community/articles/how-to-set-up-a-private-git-server-on-a-vps