Try to anwser some own questions yesterday (Let’s play with Git – settig up gitolite (not done))
- (question 1:, do I need to set the git-daemon for this? , seems not)
No, it doesn’t need the git-daemon, it hooks into ssh protocol to forward the authentication to git command (sth. like this)1: git@ubuntu:~$ more .ssh/authorized_keys2: # gitolite start3: command="/usr/share/gitolite/gl-auth-command rdccaiy",no-port-forwarding,no-X11-forwarding,no-a
4: gent-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4gfE1pdb0kpDeHAZ0olyMizYg0tMwikt3hOC5: iYRMdXKmn6LX2ybhfgVWixwOb88IOdiW2pOS3g1.... - (question 2: I have to use git clone git@192.168.56.151:repositories/gitolite-admin, in document, repositories should not be included)
It is a typical error on the public key (my problem is use openssh to generate key, while using putty’s ssh to connect), see 6-ssh-troubleshooting.mkd in gitolite
- (question 3: rdccaiy is not used in current step ?)
It is answered in question 1, the private key will be matched (no password used), it will be done automatically
Anyway, playing with git server, you need strong ssh knowledge, otherwise you will be confused, let’s continue on the configuration, and I try to add another user “user” into gitolite admin
Add user to admin the gitolite
One of the neat thing in gitolite is most of tasks are finished in config file, and it is under git control (fullfil some audit pilicy)
1: $ git clone git@192.168.56.151:gitolite-admin
2: $ cd gitolite-admin
3: # edit conf/gitolite.conf
4: $ more gitolite-admin/conf/gitolite.conf
5: repo gitolite-admin
6: RW+ = rdccaiy user
7: # copy user's public key to
8: $ scp user@192.168.56.151:.ssh/id_rsa.pub keydir/user.pub
9: $ git add keydir/user.pub
10: $ git commit -a -m "add user"
11: $ git push
Then switch to user “user” in my virtual machine, I can clone out the gitolite-admin as well (since I am admin now)
Add new repository
It is similar to the above the configure, clone out, update the conf file (I add new repo proj), and commit
1: user@ubuntu:~/git/gitolite-admin$ vi conf/gitolite.conf
2: user@ubuntu:~/git/gitolite-admin$ more conf/gitolite.conf
3: ..
4: repo proj
5: RW+ = @all
6: ..
7: user@ubuntu:~/git/gitolite-admin$ git commit -a -m "add new repo"
8: [master 87cf1b1] add new repo
9: 1 files changed, 3 insertions(+), 0 deletions(-)
10: user@ubuntu:~/git/gitolite-admin$ git push
11: Counting objects: 7, done.
12: Compressing objects: 100% (3/3), done.
13: Writing objects: 100% (4/4), 370 bytes, done.
14: Total 4 (delta 1), reused 0 (delta 0)
15: remote: Already on 'master'
16: remote: creating proj...
17: remote: Initialized empty Git repository in /home/git/repositories/proj.git/
18: To git@192.168.56.151:gitolite-admin
19: 09a85e3..87cf1b1 master -> master
See Line 16/17: the gitolite will automatically create the repository for me, excellent. see reference : 2-admin.mkd and http://progit.org/book/ch4-8.html
Then it is more time to understand the config files to config the authority.
Config it with Gitweb
The document is not clear, http://github.com/sitaramc/gitolite/blob/pu/doc/3-faq-tips-etc.mkd#helping_with_gitweb, after hacking into gitweb cgi script (bring me back to 10 years ago on perl script
, I just want to give quick solution, it is possible to arrange access control on http as well.
Create projects.list and give read permission 755 to that repo, add description under it to describe your project
1: git@ubuntu:~$ more projects.list
2: proj.git rdccaiy
3: git@ubuntu:~$ ls -al repositories/proj.git/
4: ..
5: -rwxr-xr-x 1 git git 11 2010-06-30 14:14 description
And update gitweb’s configuration
1: git@ubuntu:~$ more /etc/gitweb.conf
2: # path to git projects (<project>.git)
3: $projectroot = "/home/git/repositories";
4: # file with project list; by default, simply scan the projectroot dir.
5: $projects_list = "/home/git/projects.list";
Good to see this again with gitolite.
Summary with gitolite over gitosis
- development is more active (it means it is improving ..)
- easy setup, and all changes are in git repositories (changes are logged, audit)
- better access control
One small disadvantage is it is less popular and less documentation, while when u understand it, it is ok.
[updated after Sitaram's comments], the documentation here means the public information you can find in google, the document from the tool itself (in github) are quite good, and author Sitaram is willing to answer your questions related to gitolite