By admin , 29 April 2026

Synopsis

git instaweb [--httpd=<daemon>] [--port=<n>] [--start | --stop | --restart]

Description

The git instaweb command spins up a local web server (lighttpd, Apache, webrick, or Python's http.server) hosting the gitweb interface for the current repository. It opens a browser pointing at it, giving you a quick web UI for browsing history, files, and diffs without any setup.

Despite being a command in core Git, gitweb itself is older Perl-based software and isn't always installed by default on modern distros. Many users now prefer running a local instance of cgit, gitea, or simply browsing on a hosted forge.

In day-to-day use, git instaweb integrates closely with shell aliases, editor plugins, and continuous integration. Power users often add aliases that combine flags they always pass, or wrap the command in scripts that enforce team conventions. Output formatting can be customized via Git config — pretty formats, color schemes, and pager behavior are all tunable. When something goes wrong, the first diagnostic step is usually to re-run the command with GIT_TRACE=1 in the environment, which reveals the underlying plumbing calls. For unusual situations, the --help output (git instaweb --help) opens the full manual page with details on every option, including those rarely used in casual workflows but essential for debugging or scripting at scale.

Understanding how git instaweb interacts with the rest of Git's data model — the object database, the index, refs, and the working tree — pays dividends. Each command operates on some subset of these pieces, and knowing which it touches helps predict outcomes and recover from mistakes. Reading the official Git documentation alongside hands-on practice in a throwaway repository is the fastest way to internalize the nuances. Most production issues with Git stem from one of three causes: surprising default behavior, partial network operations, or rewriting history that was already shared. A working mental model of git instaweb's side effects helps avoid all three.

Common Options

OptionDescription
--httpd=<daemon>Web server to use.
--port=<n>Port to listen on (default 1234).
--startStart the server.
--stopStop the server.
--restartRestart it.
--browser=<cmd>Browser to open.

Examples

git instaweb --httpd=webrick
# Start gitweb backed by Ruby's WEBrick

git instaweb --port=8080 --start
# On a custom port

git instaweb --stop
# Tear down

git config --global instaweb.httpd webrick
# Save default for future invocations

Common Mistakes

Missing dependencies (Perl modules for gitweb, the chosen httpd) cause cryptic errors. Some distros ship gitweb in a separate package. For modern needs, consider cgit or hosted services.

Related Commands

gitweb, git daemon, git http-backend, git config