LinuxCommandLibrary

git-web--browse

Open Git repository in a web browser

SYNOPSIS

git web--browse [--editor | --terminal] <URL>

PARAMETERS

--editor
    Open URL in default editor ($EDITOR or vi) instead of browser

--terminal
    Use text-mode browser (e.g., lynx, links, w3m)

DESCRIPTION

git web--browse is a Git plumbing command that launches the user's default web browser to display a given URL.

It is primarily used internally by other Git porcelain commands, such as git help -w (to open manual pages in browser) and git instaweb --browse (to view the local Gitweb instance).

The command automatically detects the preferred browser via environment variables like $BROWSER, $GIT_WEB_BROWSER, or system defaults (e.g., xdg-open on Linux, open on macOS). If no browser is found, it falls back gracefully.

While not intended for direct end-user invocation, it can be useful in scripts needing to open web content reliably across platforms. It supports both graphical and terminal-based browsers, making it versatile for various environments.

Usage prioritizes cross-platform compatibility without hardcoding browser paths.

CAVEATS

Plumbing command; avoid direct use in user scripts—prefer porcelain alternatives. Requires browser/editor installed; silent failure if none available.

ENVIRONMENT VARIABLES

$BROWSER: Primary browser command.
$GIT_WEB_BROWSER: Git-specific override.
$EDITOR: Used with --editor.
$TERM: Influences terminal browser selection.

HISTORY

Added in Git 1.6.1 (2008) as plumbing utility. Evolved to support more browsers and platforms; minor tweaks in later versions for better env var handling.

SEE ALSO

Copied to clipboard