All steps below are only for example step 1 On server step 1.1.1 add a new user to manage GIT

#Whatever username you like.
useradd username

step 1.1 make sure you can login with public key For more please visit this link notice !!this post!!!. step 1.2 make dirs and init repository

#switch to su username
#make a dir for repos
mkdir repos
#make some dirs for projectOne or projectTwo or projectThree…
mkdir projectOne projectTwo
#move into projectOne
cd projectOne
#make init empty repository
git –bare init

OK that’s all… so easy, isn’t it? step 2 On client.

#make a new test git repo on client for this example
mkdir /tmp/example/
cd /tmp/example/
git init
touch somefile.txt
git add somefile
git commit -m ‘Git server test commit’
#notice: Your and meybe different from mine.
#setup remote link to your local git.
git remote add origin username@your.domain.com:/home/username/projectOne

#push your local to server.
git push origin master
#And then you can see something like this below voilà it works.
Counting objects: 3, done.
Writing objects: 100% (3/3), 232 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To username@your.domain.com:/home/username/projectOne
* [new branch] master -> master

If it shows you Permission denied (publickey,gssapi-keyex,gssapi-with-mic). Please review step 1.1 For more Howto use Git visit this website from 廖雪峰. EOF