分类: IT业界
2011-08-28 18:51:21
Nice and easy this part, on the server:
server> sudo apt-get update
server> sudo apt-get install gitolite
Creating a Public/Private key pair
If you already have one, send the public halve over to the server and skip this part. Otherwise, take a look at , then create your key pair on your client machine:
client> ssh-keygen
client> scp ~/.ssh/id_rsa.pub server:davem.pub
Configure gitolite
On the server, copy the public halve to a convenient location and run the gl-setup tool.
server> mv davem.pub /tmp/davem.pub
server> chmod 666 /tmp/davem.pub
server> sudo su gitolite
server> gl-setup /tmp/davem.pub ...
That’s gitolite setup, we now need to go back to the client machine to fully configure it. First edit your .ssh/config file, so that ssh knows how to connect to the server. Again, be careful to use the correct name for your key pair:
Host servername
IdentityFile ~/.ssh/id_rsa
Now we can clone the git repository that is used to configure gitolite:
client> git clone
Initialized empty Git repository in /home/davem/gitolite-admin/.git/
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (6/6), done.
client> cd gitolite-admin
Adding repositories
The gitolite admin contains two folders. The first, conf contains a single config file. Open that and create a new repository by adding:
repo mytest
RW+ = @all
You then need to commit the changes and push them to the gitolite server:
client> git commit -m "Added mytest repo" conf/gitolite.conf
client> git push
We then should be able to clone our new repository:
client> git clone
Adding users
To add a new user, simply add their public key halve to your clone of the gitolite-admin repo, add, commit and push.
client> cd gitolite-admin
client> cp ~/Downloads/another.pub keydir/
client> git add keydir/another.pub
client> git commit -m "Added another as a user" keydir/another.pub
client> git push