Almost 80-90 people visit How To: Install and Configure GitWeb everyday in search of setting up a web interface for their git repositories. Though gitweb is nice, it’s a bit painful to setup and the web interface is not that appealing. The other day I received this email from Klaus Silveira
Hello Kulbir,
I saw your article about installing Gitweb and i decided to send this shameless self-promotion. Maybe you could try my open-source project, GitList https://github.com/klaussilveira/gitlistI’m looking for beta testers and supporters. FLOSS. 🙂
So, I thought I’ll just give it a try. Today, I got it working and was blown away by the amazing interface! It’s almost like a super simplified version of GitHub. I was so impressed that I immediately setup a demo website at git.gofedora.com for others to look at and fall in love :-)Another good thing about GitList is that it’s very simple to setup. Below is a step by step process to install and configure GitList to expose your public Git repositories to the internet.
What You Need?
You need the following packages before you can setup GitList.
Installing Required Packages
Most modern operating systems have the above mentioned packages installed by default. Even if you don’t have them already, you can use your OS package manager to install them quickly. To install on Fedora/RedHat/CentOS using yum, use the following command
[root@whitemagnet.com ~]$ yum install php git httpd |
For Ubuntu/Debian, use the following command
[root@whitemagnet.com ~]$ apt-get install php git apache2 |
Assumptions
For setting up GitList, I am assuming the following directory paths and other variables.
- Path to public Git repositories : /home/saini/code/public/
- Path to Apache document root : /var/www/html/
- Path to Git executable : /usr/bin/git (Use “which git” to find out for your OS)
- Web URL for browsing git repos : mygit.example.com/gitlist/
Installing and Configuring GitList
Follow the following simple steps to install and configure GitList.
Step 1 : Clone GitList repository from GitHub to /var/www/html/gitlist/
[root@whitemagnet.com ~]$ cd /var/www/html/ [root@whitemagnet.com html]$ git clone git://github.com/klaussilveira/gitlist.git gitlist |
Step 2 : Create cache directory and make it globally writable
[root@whitemagnet.com ~]$ cd gitlist [root@whitemagnet.com gitlist]$ mkdir cache [root@whitemagnet.com gitlist]$ chmod 777 cache |
Step 3 : Configure GitList using config.ini
Open the config.ini (in gitlist directory) and set the option properly. Refer the sample shown below.
[git] client = '/usr/bin/git' ; Your git executable path repositories = '/home/saini/code/public/' ; Path to your repositories (with ending slash) [app] baseurl = 'http://mygit.exmaple.com/gitlist' ; Base URL of the application (without ending slash) |
Step 4 : Make sure your Apache can read your .htaccess file in gitlist directory
GitList utilizes Apache’s mod_rewrite module to provide nice URLs. Make sure your Apache is configured to read .htaccess from the gitlist directory. Open your Apache config file (generally located at /etc/httpd/conf/httpd.conf or /etc/apache2/ports.conf) and look for the following
<Directory "/var/www/html"> |
In this segment, make sure you have AllowOverride All as below.
<Directory "/var/www/html"> # Other lines omitted AllowOverride All # Other lines omitted </Directory> |
Step 5 : Reload or restart Apache daemon if needed
[root@whitemagnet.com ~]$ apachctl -k restart (or apache2ctl -k restart for Ubuntu/Debian) |
Step 6 : Get some sample repositories in your public repo directory
Get some sample repositories in your public repo directory from GitHub.
[root@whitemagnet.com ~]$ cd /home/saini/code/public/ [root@whitemagnet.com ~]$ git clone git://github.com/kulbirsaini/intelligentmirror.git [root@whitemagnet.com ~]$ git clone git://github.com/kulbirsaini/Railscasts-Sync.git [root@whitemagnet.com ~]$ git clone git://github.com/zilkey/active_hash.git |
That’s all! Now, go to http://mygit.example.com/gitlist to discover your public git repos via a cool web interface! Leave a comment if you face any issues.
Just out of curiosity, did you try it with very large git repo ? Like the kernel or libreoffice (which has over 8000 commits).
Thanks for writing about GitList. It looks very good. Not to steal thunder from GitList but have you looked at cgit? It’s another nice webinterface for Git. It’s not as slick as GitList but works very well. It’s available in the Fedora repo’s or at http://hjemli.net/git/cgit/ Now I’m off installing GitList with your steps. Thanks!
Kulbir, this is amazing. Thanks for sharing it. I’ve gone ahead and setup my own local instance of GitList. It feels almost like I have my own little Github now. I’m sure the project will continue to mature with time and become really a great way to host your own projects.
How about comparing with Gitlabhq? https://github.com/gitlabhq/gitlabhq
@pingou Doesn’t scale well. Could show stats from Linux and Libreoffice Core but the process is always killed while trying to parse all commits. Too many of them. But nifty to small scale repos.
@Pieter Thanks for mentioning cgit. I’ll have a look at the installation steps and compare both.
@Basil That was exactly my reaction when I first saw it 😀
@Bash Though Gitlabhq looks nice and more feature rich compared to GitList, it’ll be a bit of a task to setup Gitlabhq. This post was targeted at novice users who want their own web interface for their git repos but at minimal cost.
Really nice interface but as compared to the gitweb but..
I’m facing problem when I click at repository
_______________________________________________________
Not Found
The requested URL /gitlist//tree/master/ was not found on this server.
_______________________________________________________
Make sure your .htaccess in gitlist is readable by Apache. Check issue #6 on github project.
I am using Ubuntu 10.10 with Apache 2.2.16
==========================================
Getting Source
$ cd /mnt/Core/रो/bog/git/
$ git clone git://github.com/klaussilveira/gitlist.git
$ cd gitlist
$ mkdir cache
$ chmod 777 cache
==========================================
Configure stuffs and Repo
Then configured config.ini as requried
Added simlink to few of my projects
==========================================
Configuring apache2
here is my /etc/apache2/ports.conf
_________________________________________________
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz
NameVirtualHost *:80
Listen 80
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443
Listen 443
AllowOverride All
____________________________________________
========================================
Adding gitlist to /etc/apache2/conf.d
I did try with symlink to the /var/www/gitlist also but nothing changed
$ cd /etc/apache2/conf.d
$ touch gitlist
# edit gitlist
# configure file is like this
_______________________________________________
Alias /gitlist /mnt/Core/रो/bog/git/gitlist
AllowOverride All
Options FollowSymLinks +ExecCGI
AddHandler cgi-script .cgi
______________________________________
Restarted the apache
$ sudo service apache2 restart
It show the repository but it cannot be browsed!
++++++++++++++++++++++++++++++++++++
:/ any thing that i missed!
this is probably several months too late to help Rho, but in case anyone else comes along and reads this, with a default install of Apache on Ubuntu I had to enable the rewrite mod:
sudo a2enmod rewrite
I’ll suggest moving that /etc/apache2/conf.d/gitlist to /etc/apache2/conf.d/gitlist.conf because Apache includes only *.conf files from conf.d directly by default. At least, that’s the case on Fedora/CentOS. Try this change and let me know if it still doesn’t work.
I got tired of simlink and alias so i pasted the repo in /var/www/gitlist
cleaned my earlier configuration ..
then edited /etc/apache2/ports.conf.
but still not working
😐
Any ways thanx for your help! hope i get this thing working! soon
I guess you should first attempt to install this within your document root, i.e. /var/www/html/gitlist/. If it works there, then try moving it to a different location.
I got the web interface and everything running just fine but when I’m having trouble using git period lol. I am relatively new to it and would like to use my server as a development repository and then push releases to github.
I ran everything defaults like your tutorial explains.
Repo directory: /home/ruthik/code/public
WWW directory: /var/www/gitlist
Like I said the WWW works just fine. I am using an IP address to hit the server so would I type in http://(ip-address)/(repoName)? I’ve tried using multiple locations and nothing seems to work. Eclipse just returns that there was an ls error. Any help is great help! Thanks for the great tutorial though. It really is like a mini github for myself =)
This is very nice! 🙂 I did get it working and all is well. However, I just spent 2 days setting up gitolite and redmine working smoothly with ssh (hey I’m a tad new to git). Now that I got that working I went to change the repositories path to a directory in /var/lib and I get permissions problems. It is not allowed to see /var/lib obviously. How do I go about allowing it? I don’t want to simply chmod 777 but I would like to get this working 🙁 Thanks in advance!
Ruthik,
GitList doesn’t need to write anything to your git repos ever. So, you won’t need to chmod 777. If your repos are public, you can give read permissions.
Ah, I see. Thanks for such a quick reply! I think I am doing something wrong. I got rid of Redmine (way too much overkill) and installed GitLab. It works flawlessly. The respositories folder is set to /home/git/repositories in the config.ini file (/var/www/gitlist/config.ini). It reads all of the repositories but when I click one it says:
The requested URL /gitlist/repositoryname.git/tree/master/ was not found on this server
.I found this thread -> https://github.com/klaussilveira/gitlist/issues/2 so I know it’s possible. It looks like he already has it set up and working. I found out that it is searching /var/www/gitlist/repositories. I set up a symbolic link from /home/git/repositories to /var/www/gitlist/repositories and it now says permission denied. I know I am making this way more complicated than it should be. How can in I simply have gitlist read /home/git/repositories for the repos and its contents?
Hi,
I’m not able to view git repo instead it is showing index.php file.
I followed all the steps.
Am i missing something. I’m newbie to this.
Ranjan.
Hi, please help me, I have a PHP fatal error when run http://localhost/gitlist,
thanks,
PHP Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /var/www/gitlist/index.php on line 8, referer: http://localhost/
PHP Fatal error: require(): Failed opening required ‘vendor/autoload.php’ (include_path=’.:/usr/share/php:/usr/share/pear’) in /var/www/gitlist/index.php on line 8, referer: http://localhost/
Hi,
My gitlist installation does not seem to use the directory specified by the repositories property in the config.ini file. it always looks for the git projects in /{install-dir-under-apache}/{git-projname} ..
what am i doing wrong ?
;-p r a b u!
I am getting;
Oops! Unable to execute command: ls-tree -l master
After selecting a repo, a longer Opps when selecting RSS.
I see all my repos OK though. Any ideas?
I’m getting an include error on ‘vendor/autoload.php’ which I figured was because I didn’t have composer installed. Trying to install composer the way the site tells me doesn’t work either as I get a
Not sure what to do about that. Can I install these packages separately instead of using composer?
Developer recommends installing from stable package and not cloning repo. I followed your instructions and ran into problems mentioned here:
https://github.com/klaussilveira/gitlist/issues/124
Seems like your demo site at git.gofedora.com is not reachable any more, or at the moment.