howto configure git server for daily local use ?

by iman


first :

# apt-get install git

to add user on git server :
$ adduser newUser
$ su git
$ cd
$ mkdir .ssh

change newUser shell from /bin/bash to /usr/bin/git-shell in /etc/passwd file.
if you want to use passless acccess so  add public key of users in /home/newUser/.ssh/authorized_keys like this :

$ cat /tmp/id_rsa.newUser >> ~/.ssh/authorized_keys

create empty project on server in newUser home directory :
$ cd
$ mkdir project.git
$ cd project.git
$ git –bare init

now you can push new project to server from local computer. to create a fresh new project :
$ cd myproject
$ git init
$ git add .
$ git commit -m ‘initial commit’
$ git remote add origin git@gitserver:/opt/git/project.git
$ git push origin master

to clone project from server, change project then push back to remote server:
$ git clone newUser@gitserver:project.git
$ vim README (change some file)
$ git commit -am ‘fix for the README file’
$ git push origin master