howto configure git server for daily local use ?

first :Image

# 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


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s