Config Git Server

Table of Contents

1 Prepare

  • Modify hostname

modify hostname in /etc/hostname to GitServer

  • add a user and make a directory .ssh
$ sudo adduser git
$ su git
$ mkdir ~/.ssh
  • add member's ssh public key into ~/.ssh/authorizedkeys
$ cat id_rsa.bob.pub >> ~/.ssh/authorized_keys
$ cat id_rsa.jone.pub >> ~/.ssh/authorized_keys

2 Create Git Repo

  • create a bare repo
$ cd ~/
$ mkdir project.git
$ cd project.git
$ git --bare init
  • create a git repo in work pc and push the code to remote git server
$ cd myproject
$ git init
$ git add .
$ git commit -m "initial commit"
$ git remote add origin git@GitServer:/home/git/project.git
$ git push origin master
  • Using it
$ git clone git@GitSerer:/home/git/project.git
$ git pull
$ git add .
$ git commit -m "add code"
$ git push origin master

Date: 2012-08-08 三

Author: yannik

Org version 7.8.11 with Emacs version 24

Validate XHTML 1.0