1. Installing git
$ apt-get install git-core2. Add "git" user and create ssh dir in his home.
$ sudo adduser git3. 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.
$ su git // change role to "git" user
$ cd
$ mkdir .ssh
$ cat id_rsa.funkie.pub >> /home/git/.ssh/authorized_keys
Setup Gitosis
0. Change role to administrator
$ exit // change role to administrator1. Installing Gitosis
$ apt-get install python-setuptools2. Clone and install Gitosis from the project’s main site.
$ git clone git://eagain.net/gitosis.git3. 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:
$ cd gitosis
$ sudo python setup.py install
$ mv /home/git/.ssh/authorized_keys /home/git/.ssh/ak.bak4. 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.pub5. 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.
Initialized empty Git repository in /home/git/repositories/gitosis-admin.git/
Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/
$ sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update6. 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 apache22. Setup project through
$ apt-get install gitweb
$ vi /etc/gitweb.conf
沒有留言:
張貼留言