jump to navigation

How to install a Local Git Repository Viewer Using GitList and Wamp September 3, 2012

Posted by Tournas Dimitrios in PHP.

GitList is an elegant and modern web interface for interacting with multiple git repositories . It allows you to browse locally installed Git repositories using your favorite browser , viewing files under different revisions , commit history, diffs . It also generates RSS feeds for each repository, allowing you to stay up-to-date with the latest changes anytime , anywhere (isolated in the region of your intranet) . Sometimes , making your Git repositories only  available in a local intranet is  a requirement (otherwise you would use GitHub , right ? ) . Pretty easy ,  as Gitlist is written with PHP , it can be installed on any platform . These three requirements  should be met before the system is ready to “repo-fly” :  1)You already have a local Apache web-server with mod_rewrite enabled (or nginx)  , 2) PHP5.3.3  and 3) a Git-client (no matter witch , tortoisegit , msysGit , ROR’s git-client)  . In this article I’ll guide you through the process of setting up your own Git repository-viewer on a Windows box that has already Appache/php up-and running (my tests where made with WAMP)  . Don’t worry, it won’t hurt and it’s quicker than installing WordPress , Joomla or any other CMS .

An introduction before we start :

Git is an open-source  distributed version control tool , it was created by Linus Torvalds when he was building the Linux kernel . Git allows you to work on your code with relax as everything you do is reversible . It makes it easy to experiment with new ideas in a project and not worry about breaking anything . You should already know how to work with Git , otherwise this article will make no sense to you .
Composer , the new PHP package management system that aims to solve the code sharing problem  . Linux users are familiar with the sentence of “dependency hell” (libraries that depends on other libraries) . Package-managers are the rescue , for Linux : Yum – Apt-get . Programmers have also the same fears , if their  projects depend on different frameworks – libraries ,  this is the first issue to consider before starting the building process  . Composer is a command-line utility with which you install packages , it contains a dependency solver to be able to recursively resolve inter-package dependencies , a set of down-loaders , installers and other fancy things . All a user has  to do is drop a composer.json file in the project  folder and run composer.phar install. This composer.json file defines all project dependencies , and optionally configures composer . I have over-simplified the description to keep the article into reasonable size . The focus of this article is on GitList , so let’s get started .

Prerequisites :  As aforementioned , Apache — PHP5.3 and a Git-client are the prerequisites before continuing the installation process of GitList . One critical point is that the Git-client of your choice should not be installed in “Program Files” folder as the space in the path is not accepted by GitList’s configuration file (this is my conclusion ) .The root folder of the installation-partition could be a good choice (C:\git) .

Step by step process  :

  1. Open the root directory of the web-server (on my computer its on C:\wamp\www\)  and right-click  on a black area . The Git-client had created an entry into the context-box .The following command-prompt window is shown
  2. Let’s clone the GitList library (it could be also downloaded directly from the website ) . Use the following command .
    git clone https://github.com/klaussilveira/gitlist.git
  3. cd into “gitlist” (the newly created directory)  and download composer (PHP’s package manager) .
    curl -s http://getcomposer.org/installer | php
  4. Let composer download all libraries (and any dependencies ) . The work is done for use (thanks to GitList’s authors) , all libraries that GitList depends on are listed in the composer.json  file . Composer will read this file and act upon  .
    php  composer.phar  install
    I have taken the simplest approach to install composer (into current project’s folder ) . Actually composer should be installed into a folder elsewhere in the file-system (for example c:\composer)  and it’s path listed into the system’s path (right click computer icon -> properties-> advanced -> environment-variables ->path) , that would make composer also available  for other projects .
  5. This step of GitList’s installation process is to define two basic configuration options (path of the Git-client — git.exe — and location of the Git-repositories ) . Rename the config.ini.example file to config.ini and open it in your favorite editor (I prefer Notepad++) .
  6. This step is critical , the configurations that are defined in config.ini file are highly dependent from how the Git-client was installed . As aforementioned ,  the Git-client shouldn’t be installed into a directory that has space into it’s path . Even if I had tried all possible combinations (single quotes — double quotes – single and double quotes — double and single quotes ) to save the path in the config.ini file , GitList just ignored it ( it displays a message like ” Program can’t be found , unknown …..” )   .  A while back ,  during the installation process of  ROR (Ruby on Rails) , I faced a similar problem . Finally it worked when ROR was installed into a directory that has no spaces  into it’s path . The same concept apply to Windows XP and Windows7 .
    No matter what Git-client is used (ROR’s git , msysgit , tortoisegit … ) , it’s path should be listed into Window’s path variable  (right click computer icon -> properties-> advanced -> environment-variables ->path) .
    On my Box , a Windows7 ,  ROR’s git-client  is defined into config.ini . See my configuration :
  7. Let’s test GitList’s functionality . Two repositories will be cloned from GitHub . First move your cursor into your web-server’s public root directory (C:\Wamp\www) .
  8. Fire-up your browser and navigate to http://localhost/gitlist  .
    The following  screen-shot shows all locally installed Git-repos .
    The following screen-shot shows the content of an individual repository .

Links : 


1. Dub - October 1, 2012

I am really impressed together with your writing skills and also with the layout in your blog.

Is this a paid topic or did you customize it your self?
Anyway stay up the excellent high quality writing, it’s rare to look a nice blog like this one these days..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s