web-git-viewer
v1.0.2
Published
A visual git repository browser in your browser — commit graph, diffs, file explorer, markdown rendering
Maintainers
Readme
Web Git Viewer
A visual git repository browser in your browser, with a VS Code-inspired dark theme. Browse commit history with a branch graph, view diffs with syntax highlighting, and explore files with markdown rendering and media previews.
No install required — just npx web-git-viewer inside any git repo.
Screenshots
Git Mode — Commit graph, file list, and diff viewer

Files Mode — File explorer with syntax highlighting

Features
- Commit graph — visual branch/merge graph like GitLens or Fork
- Diff viewer — side-by-side line numbers, additions/deletions, syntax highlighting
- File browser — explore the working tree with a file explorer sidebar
- Markdown rendering —
.mdand.mdxfiles render as formatted HTML - Media previews — images, audio, and video files display inline
- Download — download any file directly from the viewer
- Uncommitted changes — see working tree modifications at the top of the log
- Password protection — optional password auth via CLI flag
- Responsive — works on mobile with swipe-style panel navigation
- Syntax highlighting — JS/TS, Python, Go, Rust, Java, C/C++, Ruby, PHP, SQL, Shell, and more
Usage
# View the current directory (must be a git repo)
npx web-git-viewer
# View specific repositories
npx web-git-viewer /path/to/repo1 /path/to/repo2
# Custom port
npx web-git-viewer -p 3000
# Password-protect the viewer
npx web-git-viewer --password mysecret
# Combine — cwd is auto-added if it's a git repo
npx web-git-viewer -p 8080 --password mysecret /path/to/other-repoThen open http://localhost:6181 in your browser.
Options
| Flag | Description |
|------|-------------|
| -p, --port <port> | Port to listen on (default: 6181) |
| --password <password> | Require password to access the viewer |
| -h, --help | Show help message |
How repos are resolved
- Any paths passed as arguments are validated and added
- If the current working directory contains a
.gitfolder, it is automatically added to the list - If no paths are given and cwd is not a git repo, the command exits with an error
Password Protection
When --password is set, all routes are protected behind a login page. Authentication uses:
- Timing-safe comparison (
crypto.timingSafeEqual) to prevent timing attacks - Cryptographically random session tokens (
crypto.randomBytes) — 32 bytes / 256 bits - HttpOnly, SameSite=Strict cookies — not accessible to JavaScript, no CSRF
- Rate limiting — 500ms delay on failed login attempts
- Sessions expire after 24 hours.
Modes
Git Mode
Browse commit history with a visual branch graph. Click a commit to see changed files, click a file to see the diff. Uncommitted changes appear at the top when on the default branch.
Files Mode
Explore the repository's working tree. Navigate folders, view files with syntax highlighting, preview images and audio, and read markdown files with full formatting.
Requirements
- Node.js 18+
gitCLI available on thePATH
Tech Stack
- Backend — Node.js, Express,
gitCLI - Frontend — vanilla JS, HTML, CSS (no build step, no framework)
- Zero config — no database, just point at a repo
Publishing (for maintainers)
npm login
npm publishLicense
ISC
