I have set up Git on a server, using gitosis to control commit access. I would like to configure my Git system so that anyone inside our firewall can have read access to the Git repository, and I would like to set up Gitweb as well.
I have found several Gitweb setup tutorials on various blogs, but they differ in various details and some of them are out-of-date. I'd like this question to have an up-to-date answer.
My specific setup is Red Hat Enterprise Linux. I have successfully installed Git, gitosis, and the Gitweb and Apache packages. However, I have not figured out how to configure Apache to actually grant access to Gitweb.
How do I set up my server to allow read-only access to Git, and to allow Gitweb to work?
After you install gitweb (on RHEL
$ yum install gitweb
), it should create a directoryvar/www/git
and put a file inetc/httpd/conf.d/git.conf
. If these don't exist, create them. Put all your git repos invar/www/git
and editgit.conf
to let it execute cgi scripts and rewrite URLs for gitweb. Here's what I have:There is also a gitweb.conf file in
/etc/gitweb.conf
which points to things like css, favicons and logos. I'm pretty sure those will work if you leave your projects in /var/www/git, but if you change that directory, you'll probably need to put it in gitweb.conf.Tested out on Ubuntu 8.04:
Assuming that you git projects are in
/pub/git
, edit the file:/etc/gitweb.conf
Now, setup a new virtual host in Apache config directory. Edit a new file called:
/etc/apache2/sites-available/gitweb
Enable the new site:
Restart Apache: