LinuxCommandLibrary

git-web--browse

Open Git repository in a web browser

SYNOPSIS

git web--browse [--] [URL ...]

PARAMETERS

URL ...
    One or more URLs to open in the web browser. If no URLs are provided, the command typically relies on the GITWEB_URL environment variable.

DESCRIPTION

The git-web--browse command is an internal Git helper script primarily used by git instaweb to automatically open a web browser to the locally served Gitweb interface. When git instaweb starts a temporary web server displaying your repository via Gitweb, it invokes git-web--browse to launch your default web browser and navigate to the appropriate URL. While it's generally invoked indirectly, it can also be called directly to open specified URLs. It intelligently detects common web browsers installed on the system and attempts to launch the first one found, providing a seamless experience for viewing Git repositories through a web interface. Its behavior can be customized via environment variables, allowing users to specify a preferred browser or the URL to open.

CAVEATS

The command relies on the availability of a recognized web browser executable on the system's PATH. If no suitable browser is found, it may fail to launch. Browser detection heuristics might not cover all installed browsers or might prioritize an unexpected one. When invoked directly without git instaweb, it often needs the GITWEB_URL environment variable to be set to open the intended Gitweb interface, unless URLs are provided as arguments.

ENVIRONMENT VARIABLES

git-web--browse can be configured via the following environment variables:

GITWEB_BROWSER: Specifies the command or browser to use for opening the URL. This variable overrides the default browser detection. The value can be a simple command name (e.g., firefox, chromium) or a full path to an executable.
GITWEB_URL: Specifies the URL to open if no URLs are provided as command-line arguments. This is typically set by git instaweb.

HISTORY

The git-web--browse script, along with git instaweb, has been a part of Git since its early days. It was introduced to simplify the process of quickly viewing Git repositories through a web interface, primarily for local debugging and demonstration purposes. Its development focused on providing robust cross-platform browser detection and launching capabilities to integrate seamlessly with the git instaweb workflow, reducing manual steps for users.

SEE ALSO

git-instaweb(1), gitweb(1), git(1)

Copied to clipboard