LinuxCommandLibrary

git-update-server-info

Update server info files for dumb protocols

SYNOPSIS

git update-server-info

DESCRIPTION

git update-server-info is a low-level Git plumbing command that generates and updates essential index files for dumb transport protocols like HTTP and rsync. These protocols require precomputed metadata since they cannot query the server interactively.

The command creates or refreshes two files in the :
$GIT_DIR/info/refs: Lists SHA-1s of all references (branches, tags) with their object names, enabling clients to discover available refs without scanning.
$GIT_DIR/objects/info/packs: Catalogs packfiles in $GIT_DIR/objects/pack, allowing efficient downloads.

Invoke it server-side after changes like new pushes (git-receive-pack) or repacks (git-repack). Common in hooks: post-receive, post-update, or post-repack. Ensures web-accessible repos (e.g., gitweb, plain HTTP) serve data quickly.

Not needed for smart protocols (SSH, Git). Idempotent: skips if files unchanged. Vital for anonymous read access in legacy setups.

CAVEATS

Unnecessary for smart transports (SSH/Git); only for dumb HTTP/rsync. Run post-modification or files stale, slowing clones/fetches.

EXIT CODES

0: success.
128: fatal error (e.g., permissions, invalid repo).

HOOKS INTEGRATION

Called by post-update: ${GIT_DIR}/hooks/post-update runs git update-server-info automatically.

HISTORY

Core Git plumbing since 2005 initial release by Linus Torvalds. Evolved for dumb protocol support; unchanged in function across versions.

SEE ALSO

Copied to clipboard