gitweb - Linux


Overview

gitweb is a simple web interface for browsing and interacting with Git repositories. It allows users to view, download, and upload source code, as well as browse the commit history and generate commit graphs. gitweb is ideal for setting up a self-hosted repository browser and is often used in conjunction with Git hosting services.

Syntax

gitweb [options] [<repo>]

Options/Flags

  • –port: Specify the TCP port to listen on (default: 8000)
  • –interface: Bind to a specific network interface (default: 0.0.0.0)
  • –hostname: Override the hostname bound to the interface (default: <server IP>)
  • –user: Specify the username to use for authentication (default: anonymous)
  • –repo-base: Specify the base directory for repositories (default: <gitweb directory>/repos)
  • –project-root: Specify the project root directory to show (default: <repo-base>/<repo name>)
  • –htaccess: Path to a custom Apache .htaccess file

Examples

View a repository:

gitweb /path/to/repository.git

Start a Gitweb server:

gitweb --user=username --repo-base=/var/git

Common Issues

  • Permission denied: Ensure that the Gitweb user has read access to the repositories.
  • 404 not found: Check if the repository exists in the specified repo-base directory.

Integration

gitweb can be integrated with Apache for authentication and secure connections using SSL/TLS. Additionally, it can be customized using the Apache .htaccess file.

Related Commands