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
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:
- Use password protection for web browsing.
- Link Git repositories to the default Gitweb folder.
- References:
- Ojambo.com Git Source Code Management
- git-scm.com