LGH (LocalGitHub) is a lightweight local Git hosting service that wraps git http-backend into a GitHub-like HTTP access interface, running entirely on localhost and turning a local directory into a Git server. The project is written in Go and uses the MIT license.
[Main capabilities]
- Lightweight: a single binary file with no external dependencies.
- Easy to use: intuitive CLI commands, with one-click repository setup.
- HTTP access: standard Git HTTP protocol, compatible with all Git clients.
- Authentication: built-in Basic Auth, using salted password hashing.
- Read-only mode: optional read-only mode to protect repositories.
- mDNS discovery: supports automatic discovery on the local network, facilitating team collaboration.
- Tunnel support: one-click exposure to the internet (ngrok, cloudflared).
- Smart archiving (v1.2.0): lgh up / lgh save commands, automatically generating .gitignore; automatically detecting project types (Python, Go, Node, Java, Rust, AI/ML) and generating appropriate .gitignore; blocking large files over 50MB and sensitive files (.env, *.key).
- MCP Server (v1.2.0): integrates AI agents (Cursor, Claude Desktop); when used through MCP, returns the exact triggered_job_ids: [...] array, making it easy for AI to track pipeline status.
- Agent integration (v1.1.0+): real-time subscription (Unix Socket), connecting to ~/.localgithub/lgh.sock to receive a JSON event stream of all actions (repository added, git push, etc.), with the protocol being Unix Socket, JSON Lines, read-only and limited to local user connections; event replay (simulation), injecting past events into the system to test agents, with replayed events containing "_replayed": true in the payload.
[Installation methods]
- Download the precompiled binary (recommended): download lgh-windows-amd64.exe, rename it to lgh.exe, move it to a folder in %PATH% (such as C:\Program Files\lgh), and run it in PowerShell or Command Prompt.
- Installation script.
- Homebrew (macOS).
- Build from source.
- Go Install.
[Usage]
- Initialize the LGH environment: create the required directories and configuration files in ~/.localgithub/.
- Start the server: by default it listens on http://127.0.0.1:9418。
- One-step add and push (v1.0.9+): Initialize the Git repository (if not yet initialized), automatically commit all files (if the repository is empty), register with LGH, and immediately auto-push to the server.
- Add only without pushing: Suitable for situations requiring manual control.
- Smart archive (v1.2.0+): The fastest way to back up and sync code. After adding, standard Git commands can be used; you can also clone from elsewhere.
[Command Reference]
- Repository management (v1.0.4+): Manage local repository status without complex git commands; view the current remote being pushed to; easily switch between LGH and origin (such as GitHub).
- Monitoring and logs (v1.0.5+): Track system activity and repository changes in real time.
- Proxy integration (v1.1.0+): LGH is designed as the "source of truth" for AI agents.
[MCP Quick Setup] Scenario 1: LGH is already installed; update it in the AI editor configuration file (such as ~/.cursor/mcp.json). Scenario 2: LGH is not yet installed (one-click install): Run a single command to install the latest binary, then follow Scenario 1. LGH is a single binary file, and no separate "MCP plugin" is needed; the lgh binary itself is the MCP server. You can have the AI agent ask: "Check LGH status"; if it calls lgh_status and responds, the configuration is successful.
[Authentication and Security] Enable authentication when sharing repositories on the network: set up authentication, client authentication, security best practices. Passwords must be at least 8 characters; the configuration file stores salted hashes rather than plaintext. See docs/SECURITY.md for details. Tunnel functionality: Supports multiple ways to expose local services to the internet; before exposing to the internet, be sure to enable authentication (lgh auth setup) or use a reverse proxy.
[Advanced Usage] LAN sharing (with authentication), production deployment (recommended), CI/CD integration.
[Comparison with Other Solutions] LGH's positioning: Fill the gap between "simple file sharing" and "full Git platforms."
[System Requirements] Go 1.23+ (for building), macOS, Linux, or Windows.
[Contributing and License] Contributions are welcome; see CONTRIBUTING.md for details; Fork the repository, create a feature branch, commit changes, push the branch, and create a Pull Request. The project uses the MIT License.
[Acknowledg] spf13/cobra (CLI framework), spf13/viper (configuration management), fatih/color (terminal coloring), hashicorp/mdns (mDNS support).