Apache is used as a web server to run gitweb.
Below is a step by step guide to setup git inside Linux using Apache.
1. Download gitweb from web. Run "yum install gitweb" for distributions supporting yum.
2. Add the following code to httpd.conf file (generally in /etc/httpd/conf/httpd.conf)
DocumentRoot /opt/git
ServerName git.pawan.com
Allow from all
AllowOverride all
Order allow,deny
Options ExecCGI
SetHandler cgi-script
DirectoryIndex gitweb.cgi
SetEnv GITWEB_CONFIG /etc/gitweb.conf
</VirtualHost>
NameVirtualHost *:80
3. Set the repository root path inside /etc/gitweb.conf as shown below.
$projectroot = '/opt/git/';
4. Restart Apache HTTPD server to take effect by "/etc/init.d/httpd restart" or the corresponding command as per your distribution.
5. Visit http://localhost/git to view git repositories on web.