Setting up a simple git hosting in a windows environment is surprisingly difficult – since there are very few git tools available for windows! I recently had to host git on windows and integrate it with phabricator – turns out it was more difficult than I originally thought was possible!! Since it took me a while to get this working (even after lots of googling), thought would put a post on this – to help anyone thinking of doing the same.  This led to the current post Simple Git Hosting with Apache (or XAMPP)!!

Pre-Requisites

Here are the pre-requisites:

  1. Git – obviously! (I have installed it on C:\Program Files (x86)\Git on my laptop)
  2. Apache or XAMPP – I had XAMPP 1.8.3 version already installed – so used the same (XAMPP is installed on C:\xampp)
  3. Git Repository: My git repository is under H:\GitDesigns folder – If you don’t have one, use Git documentation online to learn how to create one!!

Setup Steps

1. First copy Git\bin\libiconv-2.dll to Git\libexec\git-core

2. Add a virtual host in apache / xampp – so that requests with that server name are treated differently! I added git.expertz.me in my hosts file to point to localhost (since everything is inside the network!) and added the following entry in C:\xampp\apache\conf\extra\httpd-vhosts.conf file In case of normal apache, add the virtualhosts entry in the normal place….

3. Restart the apache server and access the URL: http://git.expertz.me and you should be able to browse the repository!!

4. For accessing the repository from remote client – make sure you access with exact server name you had entered earlier (I had to add hosts entry to correctly point git.expertz.me to my git server) and rest is as usual with git clone….

 

Observations

1. Obviously you need to enhance this to include access control (refer to some of the links below) – since my requirement was just simple hosting, this was enough!

2. My repository included some java library files – so repository size had grown. I found out that there are somethings you can do to set like below to make it work

Unfortunately it never worked for me (even after increasing the size from 10m to 100m) using git://git.expertz.me…… But the HTTP hosting option above worked fine!! In case your HTTP hosting doesn’t work for large repositories (and you get EOF errors, try setting the above two entries as well!!)

3. Documentation for GitWeb (and others) was very confusing and this option was easier for me.

 

Resources

Some of the links that helped me to get this up and running

http://www.parallelsymmetry.com/howto/git.jsp

http://stackoverflow.com/questions/12759854/client-denied-by-server-configuration-while-trying-to-use-git-http-backend-exe

http://www.oudmaijer.com/2011/07/19/git-server-on-windows/

http://www.jedi.be/blog/2009/05/06/8-ways-to-share-your-git-repository/#apachehttp

 

Share this:

About Chethan

I am the Founder and Director of Expertz.me! I am an Entrepreneur, Architect, Problem Solver & Techy - All rolled into one!!

  • Pallav Dasgupta

    Hello sir, thanks for sharing this article. While following the steps you have mentioned above on hitting the URL to access my local git repository I am getting error as
    “Description: Unable to locate the server named XXXX the server does not have a DNS entry”, have added the server name in the httpd-vhosts.conf under the ServerName field, also I have made an entry to my hosts file as well. Can you please suggest something on this ?