Gitweb Git Web Interface

Gitweb Web Interface For Git

Git comes with two graphical user interface (GUI) tools. The portable graphical interface to Git git-gui is used to commit repository changes. The git repository browser gitk is used to browse or display changes in a repository.

Both git-gui and gitk focus on single repositories. Change to the folder containing a git repository in order to use either gitk or git-gui (git gui from command line). Gitweb allows browsing of all repositories.

This tutorial uses Git for source code management. Git is cross-platform compatible (Unix, Linux, MacOS and Windows). Git can be downloaded from git-scm.com

    Tools are required:

  • Text editor (preferable command line).
  • Secure Shell (SSH) Client.
  • Shell Access (command line).
  • Web Server.
  • Git.
  • Gitweb.

Optional Installing Git

Git install instructions are available at Ojambo.com Git Source Code Management.

Setting Up Gitweb

## ASSUMING DEBIAN LINUX BASED SYSTEM ##
# Install Gitweb #
sudo apt-get install gitweb
# Optional Move Repository Folder #
mv /path-to-myRespositories /var/cache/git
# Optional Symlink Repository Folder #
ln -s /path-to-myRespositories /var/cache/git

Install Gitweb. The default folder for Gitweb Git repositories is “/var/cache/git”. Current repositories can be moved or symlinked to the default Gitweb Git folder.

Optional Apache Password Protect Gitweb

## ASSUMING DEBIAN LINUX BASED SYSTEM ##
# Assuming Apache Web Server Installed #
	nano /etc/apache2/conf.d/gitweb
		Alias /gitweb /usr/share/gitweb
		
		<Directory /usr/share/gitweb>
			Options FollowSymLinks +ExecCGI
			AddHandler cgi-script .cgi
			<IfModule mod_authn_file.c>
				AuthType Basic
				AuthName "Ojambo.com's personal Git Repositories"
				AuthUserFile /path-to-password-folder/.htpasswd
			</IfModule>
			Require valid-user
		</Directory>
# Restart Apache #
service apache2 restart

For security, a password will be required for Gitweb. Apache will need to be restarted in order for the changes to propagate. More information about password protecting folders using Apache is available at Ojambo.com Apache Password Protect.

Demonstration:

Ojambo.com Gitweb Git Web Interface Tutorial

Image Missing
Ojambo.com Gitweb Authentication Required

Image Missing
Ojambo.com Gitweb Show All Repositories

Image Missing
Ojambo.com Gitweb Show Single Repository

Conclusion:

Git comes with Graphic User Interfaces for browsing individual Git repositories. Gitweb allows Git repository browsing using a web browser. Gitweb must be setup manually.

Gitweb allows browsing of multiple repositories. Security can be implemented for the webserver to allow only specific individuals to browse the Git repositories.

    Recommendations:

  1. Use password protection for web browsing.
  2. Link Git repositories to the default Gitweb folder.

Tags: , , ,

This entry was posted on Wednesday, March 20th, 2013 at 12:00 am and is filed under Tips & Tricks. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “Gitweb Git Web Interface”

  1. Ojambo Gitweb Git Web Interface Video .Htaccess Video 0054 Says:

    April 26th, 2013 at 12:06 am

    […] Video for the Ojambo.com Gitweb Git Web Interface article. Part One of […]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>