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:

40 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" />

Unknown 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

Unknown said...
This comment has been removed by the author.
Unknown said...

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

Unknown said...

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

Unknown 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

Unknown 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

Unknown 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

Unknown 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

Unknown 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

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

Anonymous 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

Unknown said...

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

Unknown said...

Updating with the latest technology and implementing it is the only way to survive in our niche. Thanks for making me this article. You have done a great job by sharing this content in here. Keep writing article like this.
Angularjs training in chennai | Angularjs course in Chennai

Unknown said...

The strategy you posted was nice. The people who want to shift their career to the IT sector then it is the right option to go with the ethical hacking course.
Ethical hacking course in Chennai | Ethical hacking training in chennai

Riya arora said...

informative blog thanks for providing such a great information.
SEO jobs in Hyderabad
SharePoint jobs in Hyderabad
SharePoint jobs in Chennai

Mehgna Sharma said...

This technical post helps me to improve my skills. Thanks for sharing Web Designing training in noida | SAS Summer Training in Noida | Java Training in Noida

Anonymous said...

SAP software which automates the business processes or handling and made the easy control for every business owner. By using this module we can control our all business activities just by sitting on the one place. You can get more information and this SAP software from this https://twbs.com/.

KB said...


This is a great inspiring article. I am pretty much pleased with your good work. You put really very helpful information.
eCommerce Supply Chain Management

tansitanu said...

Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
big-data-hadoop-training-institute-in-bangalore

Anonymous said...

This is extremely great information for these blog!!
Weblogic Administration Training

Unknown said...

Nice post if you are interested you can visit http://www.tambarampcsacademy.com/java-python.php

Vicky Ram said...

Wonderful post!!Thank you for sharing this info with us.
Keep updating I would like to know more updates on this topic
Very useful content, I would like to suggest this blog to my friends.


iOS Course in Chennai


iOS Training

Unknown said...

hCue provides an opportunity to Medical billing software to enhance their patient care but also can increase the portability of the organization.PHP Training in Chennai |
PHP Training Chennai

Unknown said...

Very interested article and it contains more useful information
Informatica Training in Chennai | Informatica Training Institute in Chennai

Dipanwita said...

This is a very interesting blog. I loved it. java training in chennai

24Layouts said...

Thanks For Sharing Such an Useful and Informative Post...

Vizag Real Estate

mathimathi said...

I will appreciate your help once again. thanks in advance
JAVA Training in Chennai |
JAVA Course in Chennai |
Best JAVA Training in Chennai

mathimathi said...

I have to agree with everything in this post. Thanks for the useful information.
SAS Course in Chennai |
SAS Training Institutes in Chennai |
SAS Institute in Chennai


Xplore IT Corp said...

Hey Nice Blog!! Thanks For Sharing!!!Wonderful blog & good post.Its really helpful for me, waiting for a more new post. Keep Blogging!
networking training
ccna Training

thulasiram said...

just love the good work you are doing.
JAVA Training in Chennai |
JAVA Course in Chennai |
Best JAVA Training in Chennai

thulasiram said...

This was a good suggestion that you put up here.hope that it benefits all the ones who land up here.
Big Data Training in Chennai |
Big Data Training |
Big Data Course in Chennai



Karthik said...


It's very useful to read your article in this blog and very informative to develop my skills and for the career
iOS Training in Chennai
iOS Training Institute in Chennai
iOS Course in Chennai
mobile application development training in chennai
iOS Training

Mirnalini Sathya said...

I think this was one of the most interesting content I have read today. Please keep posting.


Loadrunner Training in Chennai
French Classes in Chennai
Big Data Training in Chennai
Hadoop Training in Chennai
Android Training in Chennai
Selenium Training in Chennai
Digital Marketing Course in Chennai
JAVA Training in Chennai
Best JAVA Training in Chennai

rohini said...

Found your post interesting to read. I cant wait to see your post soon. Good Luck for the upcoming update.This article is really very interesting and effective.
Mobile phone Battery replacement|Mobile phone unlocking service | 100% genuine mobile parts | Mobile service center in chennai | Mobile service center in chennai | Mobile phone glass replacement | Mobile service center in chennai | Mobile phone unlocking service

Eliza Beth said...

I found that site very usefull and this survey is very cirious, I ' ve never seen a blog that demand a survey for this actions, very curious... theymakedesign

Eliza said...

i love reading this article so beautiful!!great job! design agency

Flora said...

Good article. I liked to read your article, valuable information.
use of python
most paid programming language
benefits of learning python
hadoop career
java interview questions for experienced
selenium interview questions and answers for experienced

Sapna said...

Thanks for sharing such informative guide. This post gives me detailed information. I am working as trainer in leading IT training academy offering Linux Training Course in Delhiand i use your guide to educate my students