Gitolite服务器搭建 (How to install and configure Gitolite)

要做新项目了,老大要先做一个原型,但不能污染公司的主代码仓库,于是大家决定用目前最流行的Git。Google了一下,目前Linux下最好的Git服务器搭建工具就是Gitolite。在这总结归纳一下方法。我用的平台是Ubuntu 12.04.

Step 1. Add Group “git” and User “git”

Step 2. Install gitolite

Switch user “git” first

Get gitolite from github first

Make a “bin” directory where gitolite will be installed into.

Install gitolite to bin

Step 3. Setup gitolite

Before we setup gitolite, you need to get the administer’s ssh public key file.

As we know, when we call “ssh-keygen” on our workstation, we can get a private key (don’t share it to others) and a public key. Gitolite need the public one. For more details, please read gitolite-doc.

As I showed to you, I copy the public key to gitolite_server:/tmp/jasonlee.pub. Next we setup the gitolite and configure the admin’s public key.

Then you will find there are some files and folders generated.

 Step 4. Add a new repo and a user.

As a admin, if you want to manage repos and users, you need to clone a special repo “gitolite-admin” first.

Now, jasonlee is the admin. Let’s clone that repo on my workstation first.

Then you can find two folders conf and keydir.

In folder conf, there is gitolite’s configuration file gitolite.conf. Default, it likes

 

keydir is the folder to put the public key files of users.

If you want to add a user jason and a new repo foo.

You need put jason.pub to keydir first and add following lines in gitolite.conf.

Then commit and push all changes to gitolite server.

OK, everything is done! Repo foo is ready for jason now. 🙂

发表评论

电子邮件地址不会被公开。 必填项已用*标注