Setting up GIT server

This note provides how to setup private GIT repository server.

Server setup

Install git

yum install git

Create user
useradd gitacc
passwd gitacc

Create ssh directory
mkdir .ssh && chmod 700 .ssh
touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
Create key to authenticate
ssh-keygen -C ""
Create entries of public keys for allow users
cat .ssh/ | ssh user@ "cat >> ~/.ssh/authorized_keys"
Create project repository at server
cd /home/gitacc
mkdir "project"
cd "project"
git init --bare

Client configuration

Change to working directory
cd "project"
git init
git add .
git commit -m 'initial commit'
git remote set-url origin gitacc@
git init
git remote add origin gitacc@
Commit new file
git add test.txt
git commit -m 'created test.txt'
git push origin master
Clone project
git clone gitacc@