Monday, January 31, 2011

Installing git-web on a java web server

Installing git-web on a java web server such as tomcat or jetty is pretty simple. All java web-servers have the capability to run cgi scripts such as git-web.

The difficult part of installing git-web is setting up all the configuration.

First, install git-web using your linux installation tool such as yast, yum, rpm, etc. Your install will assume you will use the apache web server.

Now for the hard part. Every linux distro installs the files in different locations. Here is where my files are installed:
The git-web config file:
/etc/apache2/conf.d/gitweb.conf (This tells git-web where your repositories are)
The git-web install directory:
/usr/share/git-web (The git-web cgi script and web files)

The next step is to get git-web working. There are a ton of tutorials out there. Most of them are pretty bad. I would just open up the gitweb.cgi file in a text editor and edit the parameters.

You will probably want to change the $projectroot variable to point to your git repository location.

Once you get git-web working, you are ready to install it in your java web server.

First, create a war directory (mine is called git-web) and move the git-web files to these locations:


Next, create the web.xml file in the WEB-INF directory. It should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>cgi</servlet-name>
<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>cgiPathPrefix</param-name>
<param-value>WEB-INF/cgi-bin</param-value>
</init-param>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cgi</servlet-name>
<url-pattern>/gitweb.cgi</url-pattern>
</servlet-mapping>
</web-app>

Voila! Install this war location on your java web server and git-web is ready to go:

25 comments:

kew said...

Thanks for the how-to!... I added this to the web.xml so you can have a clean url:

<welcome-file-list>
<welcome-file>gitweb.cgi</welcome-file>
</welcome-file-list>

I also had to add a META-INF/context.xml with privileged="true" for the cgi to run:

<?xml version="1.0" encoding="UTF-8"?>
<Context antiResourceLocking="false" privileged="true" useHttpOnly="true" />

Sqiar BI said...

our company http://www.sqiar.com/ which provide the services like Data Warehousing,(Data modelling,Data mining).in this services company data will be converting into meaningful form.so user take better and informed decisions

Verna J. Lacombe said...
This comment has been removed by the author.
Verna J. Lacombe said...

Mobile application for any website has become necessity. Your post gives some very useful tips on mobile application development.SEO services

Nazim Hafeez said...

Is there any C# .NET tool for doing the same thing. I have never worked on Java so finding it difficult to undestand.

savitha singh said...

I agree with your thoughts!!! As the demand of java programming application keeps on increasing, there is massive demand for java professionals in software development industries. Thus, taking training will assist students to be skilled java developers in leading MNCs. JAVA J2EE Training in Chennai | JAVA J2EE Training Institutes in Chennai

Badrul Jaman said...

Excellent Post and most useful information... Very much useful and nice blog.. Thanks we help in assisting valuable resources in iOS and informatica technologies..For any iOS are Informatica training IICT is the top institute in Chennai.
iOS Training in Chennai | Informatica Training in Chennai

Roshini RS said...

This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic.
Regards,
Informatica training in chennai|Best Informatica Training In Chennai

Arthur Mac said...

Information about JAVA have spread all over the world wide web, but this information is quite unique and attractive. Thanks for sharing it in here. Keep blogging

JAVA Training in Chennai
JAVA J2EE Training Institutes in Chennai

Steve Smith said...

Great and Useful Article.

Online Java Training

Online Java Training from India

Online Java Training

Online Java Training From India

Java Training Institutes in Chennai

Java Training in Chennai

jhansi joe said...

I have read your blog, it was good to read & I am getting some useful info's through your blog keep sharing... Informatica is an ETL tools helps to transform your old business leads into new vision. Learn informatica training in Chennai from corporate professionals with very good experience in informatica tool.
Regards,
Informatica training center in Chennai|Informatica training chennai|sas training in Chennai|sas course in Chennai

Roshini RS said...

Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.
Regards,
SAP course in chennai|SAP Training in Chennai | sap course in Chennai|SAP training in chennai

Amirtha rao said...

I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.
Regards,

cognos Training in Chennai|cognos Training Chennai

Melisa said...

Thanks for sharing those useful basic programming stuff’s of Python, it helps me to explore my knowledge in programming...if you want to switch your career in developing area you should know the basic of programming’s for that you have to read python because it was the first programming language for more details contact the link.
Regards,
Python Training in Chennai|Python Training|Python Training Institutes in Chennai

jhansi joe said...

This technical post helps me to improve my skills set, thanks for this wonder article I expect your upcoming blog, so keep sharing...
Regards,
ccna training in Chennai|ccna courses in Chennai|ccna training center in Chennai

for IT the said...

Java Training in Chennai | Online Java Training India | Java Training Institutes in Chennai | Java J2EE Training Institutes in Chennai | IT Technical Articles

for IT the said...

Java Training | Java Course in Chennai | Java Training Chennai | Online Java Training | Java Articles

Nasreen Basu said...

too good piece of information, I had come to know about your site from my friend sajid, bangalore,i have read atleast 7 posts of yours by now, and let me tell you, your web-page gives the best and the most interesting information. This is just the kind of information that i had been looking for, i'm already your rss reader now and i would regularly watch out for the new post, once again hats off to you! Thanks a lot once again, Regards, informatica mdm training in hyderabad,informatica training in hyderabad

Melisa said...

Quite Interesting post!!! Thanks for posting such a useful post. I wish to read your upcoming post to enhance my skill set, keep blogging.
Regards,
SAS Course in Chennai|SAS Training in Chennai

Gopi Perumal said...

This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic..

Regards,
CCNA Training in Chennai | CCNA Training Institute in Chennai | Best CCNA Training in Chennai

Nicky Paul said...

he WordPress Simple Paypal Shopping Cart is a simple to utilize and lightweight WordPress module that permits you to offer items or administrations online in a single tick from your WordPress blog
wordpress cart

Rose Angel said...

This is an incredible rousing article.I am essentially satisfied with your great work Buzz Applications

geethu said...

The strategy you have posted on this technology helped me to get into the next level and had lot of information in it. The Struts, Spring, Hibernate are the advanced level of programming language which are most widely used.
struts training in chennai | struts training

mary Brown said...

Java Training in Chennai
Online MVC Training India | Angularjs Training | javase j2ee javaee interview questions | Java Training in Chennai |


Java Training in CHennai

mary Brown said...

JMS Training Institutes in Chennai | JSP Training Institutes in Chennai | Java Spring Hibernate Training Institutes in Chennai | EJB Training Institutes in Chennai | Hibernate Training Institutes in Chennai |

JSF Training Institutes in Chennai | Java EE Training Institutes in Chennai | J2EE Training Institutes in Chennai | | | | Core Java Training Institutes in Chennai | Java Training Institutes