Last Updated: February 25, 2016
·
359
· jishnu7

Creating git server

configure global parameters.

$ git config --global user.name "Name"
$ git config --global user.email "email@example.com"

generate ssh key

$ ssh-keygen -t rsa -C "email@example.com"

create a user account for git

$ sudo adduser git
$ su git
$ cd ~

add public keys of users who need access to git

$ mkdir .ssh
$ cat /tmp/jishnu.pub >> ~/.ssh/authorized_keys

create git project

$ mkdir project.git
$ cd project.git
$ git --bare init

restrict git user to only doing git activities by changing shell to git-shell

$ which git-shell
$ sudo vim /etc/passwd

client side.

$ git init
$ git remote add origin git@server:project.git
$ git touch README
$ git add README
$ git commit -m 'initial commit'
$ git push origin master