2011年1月18日 星期二

Git Server setup SOP

Setup user call "git"

1. Installing git
$ apt-get install git-core
2. Add "git" user and create ssh dir in his home.
$ sudo adduser git
$ su git // change role to "git" user
$ cd
$ mkdir .ssh
3. Append somebody's (e.g., funkie) public key to authorized_keys which is in /home/git/.ssh/ to let the user (e.g., funkie) has authorization to access git repository on server. P.S. the public key can be generated by "ssh-keygen -t rsa" on funkie's computer.
$ cat id_rsa.funkie.pub >> /home/git/.ssh/authorized_keys

Setup Gitosis



0. Change role to administrator
$ exit // change role to administrator
1. Installing Gitosis
$ apt-get install python-setuptools
2. Clone and install Gitosis from the project’s main site.
$ git clone git://eagain.net/gitosis.git
$ cd gitosis
$ sudo python setup.py install
3. Gitosis is going to manage your keys for you, so you need to remove the current file, re-add the keys later, and let Gitosis control the authorized_keys file automatically. For now, move the authorized_keys file out of the way:
$ mv /home/git/.ssh/authorized_keys /home/git/.ssh/ak.bak
4. Now it’s time to initialize Gitosis. You do this by running the gitosis-init command with your personal public key. If your public key isn’t on the server, you’ll have to copy it there:
$ sudo -H -u git gitosis-init < id_rsa.pub
Initialized empty Git repository in /home/git/repositories/gitosis-admin.git/
Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/
5. This lets the user with that key modify the main Git repository that controls the Gitosis setup. Next, you have to manually set the execute bit on the post-update script for your new control repository.
$ sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
6. Let’s do an actual Git command — you’ll clone the Gitosis control repository:
$ rm gitosis //remove the dir that you clone from project’s main site before.
$ git clone git@gitserver:gitosis-admin.git


Setup Gitweb

1. Installing Git Web
$ apt-get install apache2
$ apt-get install gitweb
2. Setup project through
$ vi /etc/gitweb.conf

沒有留言:

張貼留言