LGH (LocalGitHub) is a lightweight local Git hosting service. It wraps git http-backend to provide GitHub-like HTTP access, running entirely on localhost - turning your local directory into a Git server.
- π Lightweight - Single binary, no external dependencies
- π§ Easy to Use - Intuitive CLI commands, one-click repository setup
- π HTTP Access - Standard Git HTTP protocol, compatible with all Git clients
- π Authentication - Built-in Basic Auth with salted password hashing
- π‘οΈ Read-Only Mode - Optional read-only mode to protect repositories
- π‘ mDNS Discovery - Automatic LAN discovery for team collaboration
- π Tunnel Support - One-click expose to internet (ngrok, cloudflared)
- β‘ Smart Archival (v1.2.0) -
lgh up/lgh savecommands with auto .gitignore - π€ MCP Server (v1.2.0) - AI Agent integration (Cursor, Claude Desktop)
Download the pre-built binary for your system:
| OS | Architecture | Download |
|---|---|---|
| macOS | Apple Silicon (M1/M2/M3) | lgh-1.2.0-darwin-arm64 |
| macOS | Intel | lgh-1.2.0-darwin-amd64 |
| Linux | x86_64 | lgh-1.2.0-linux-amd64 |
| Linux | ARM64 | lgh-1.2.0-linux-arm64 |
| Windows | x86_64 | lgh-1.2.0-windows-amd64.exe |
# Install after download (macOS ARM64 example)
chmod +x lgh-1.2.0-darwin-arm64
sudo mv lgh-1.2.0-darwin-arm64 /usr/local/bin/lgh- Download
lgh-1.2.0-windows-amd64.exe - Rename to
lgh.exe - Move to a folder in your
%PATH%(e.g.,C:\Program Files\lgh\) - Run in PowerShell or Command Prompt
# Install
curl -sSL https://raw.githubusercontent.com/JoeGlenn1213/lgh/main/install.sh | bash
# Uninstall
curl -sSL https://raw.githubusercontent.com/JoeGlenn1213/lgh/main/uninstall.sh | bash# Add tap
brew tap JoeGlenn1213/tap
# Install
brew install lgh
# Uninstall
brew uninstall lghgit clone https://github.com/JoeGlenn1213/lgh.git
cd lgh
make build
sudo make install
# Or manually
go build -o lgh ./cmd/lgh/
sudo mv lgh /usr/local/bin/go install github.com/JoeGlenn1213/lgh/cmd/lgh@latestlgh initThis creates the necessary directories and config files in ~/.localgithub/.
# Start in foreground
lgh serve
# Start in background (daemon mode)
lgh serve -d
# Check server status
lgh status
# Stop the server
lgh stopServer listens on http://127.0.0.1:9418 by default.
The fastest way to host a local project:
cd your-project
lgh add . --pushThis single command will:
- Initialize a Git repo (if not already one).
- Auto-Commit all files (if the repo is empty).
- Register it with LGH.
- Auto-Push to the server immediately.
If you prefer manual control:
lgh add .
# Then push manually later
git push -u lgh mainThe fastest way to backup and sync your code:
# One-click: auto .gitignore + add + commit + push
lgh up "commit message"
# Local save only (no push)
lgh save "WIP: work in progress"Smart Ignore automatically:
- Detects project type (Python, Go, Node, Java, Rust, AI/ML)
- Generates appropriate
.gitignorefile - Blocks large files (>50MB) and sensitive files (.env, *.key)
After adding, you can use standard Git commands:
git push lgh main
# or
git pushgit clone http://127.0.0.1:9418/your-project.git| Command | Description | Example |
|---|---|---|
lgh init |
Initialize LGH environment | lgh init |
lgh serve |
Start HTTP server | lgh serve -d |
lgh stop |
Stop running server | lgh stop |
lgh add |
Add repository to LGH | lgh add . --name my-repo |
lgh list |
List all repositories (detailed) | lgh list |
lgh status |
View server status and repo list | lgh status |
lgh remove |
Remove repository (use status/list first) | lgh remove my-repo |
lgh tunnel |
Expose to internet | lgh tunnel --method ngrok |
lgh auth |
Manage authentication | lgh auth setup |
lgh -v |
Show version | lgh -v |
lgh doctor |
Check system health | lgh doctor |
lgh repo status |
Check repo connection state | lgh repo status |
lgh remote use |
Switch active remote | lgh remote use lgh |
lgh clone |
Simple clone from LGH | lgh clone repo-name |
lgh events |
View/watch system event logs | lgh events -n 20 --watch |
lgh up |
One-click commit and push | lgh up "message" |
lgh save |
Local save (no push) | lgh save "WIP" |
lgh log |
View server logs | lgh log --level ERROR |
lgh mcp |
Start MCP server for AI | lgh mcp |
LGH provides tools to manage your local repository state without complex git commands.
See exactly which remote you are pushing to:
lgh repo statusEasily switch between LGH and origin (e.g., GitHub):
lgh remote use lgh # Switch upstream to LGH
lgh remote use origin # Switch upstream to Origin# Clone easily (no full URL needed)
lgh clone my-project
# Inspect bare repo details (HEAD, branches)
lgh repo inspect my-project
# Set default branch for bare repo
lgh repo set-default my-project main
# Check system health
lgh doctorTrack system activity and repository changes in real-time.
# View recent events
lgh events
# Watch for new events (like 'tail -f')
lgh events --watch
```bash
# Filter by type
lgh events --type git.pushLGH is designed to be the "source of truth" for AI Agents.
1. Real-time Subscription (Socket)
Connect to the Unix Domain Socket at ~/.localgithub/lgh.sock to receive a real-time stream of JSON events for every action (repo added, git push, etc.).
- Protocol: Unix Socket, JSON Lines.
- Security: Read-Only. Only the local user can connect.
2. Event Replay (Simulation) Inject past events back into the system to test your Agents without performing real Git actions.
# Replay last 10 events to all connected agents
lgh events replay --last 10
# Replay specific event types
lgh events replay --type git.pushNote: Replayed events include β_replayedβ: true in their payload.
# Daemon mode (background)
lgh serve -d
# Read-only mode (disable push)
lgh serve --read-only
# Custom port
lgh serve --port 8080
# Enable mDNS for LAN discovery
lgh serve --mdns
# Bind to all interfaces (LAN access)
lgh serve --bind 0.0.0.0Want to connect LGH to Cursor or Claude Desktop?
Simply update your AI editor's config file (e.g., ~/.cursor/mcp.json) with:
{
"mcpServers": {
"lgh": {
"command": "lgh",
"args": ["mcp"]
}
}
}Run this single command to install the latest binary:
curl -sSL https://raw.githubusercontent.com/JoeGlenn1213/lgh/main/install.sh | bashOnce installed, follow the "Scenario 1" step. We designed LGH as a single binary, so you don't need a separate "MCP Plugin". The lgh binary IS the MCP server!
Ask your AI Agent:
"Check LGH status" If it calls
lgh_statusand responds, you're all set!
# Custom name
lgh add . --name custom-name
# Don't auto-add remote
lgh add . --no-remoteEnable authentication when sharing repositories over the network:
# Interactive setup (hidden password input)
lgh auth setup
# View auth status
lgh auth status
# Generate password hash (for manual config)
lgh auth hash
# Disable auth
lgh auth disable# Method 1: URL embedded credentials
git clone http://username:password@192.168.1.100:9418/repo.git
# Method 2: Use Git credential helper
git config credential.helper store
git clone http://192.168.1.100:9418/repo.git
# Enter username/password on first access| Scenario | Recommended Config |
|---|---|
| Local development | Default config (127.0.0.1) |
| LAN sharing | --bind 0.0.0.0 --read-only + auth setup |
| Internet exposure | Reverse proxy (Caddy/Nginx) + TLS + Auth |
β οΈ Security Note: Password must be at least 8 characters. Config file stores salted hash, not plaintext.
See docs/SECURITY.md for detailed security guidelines.
~/.localgithub/
βββ config.yaml # Global config
βββ mappings.yaml # Repository mappings
βββ lgh.pid # Server PID file
βββ repos/ # Bare repository storage
βββ MyApp.git/
βββ ProjectB.git/
~/.localgithub/config.yaml:
port: 9418
bind_address: "127.0.0.1"
repos_dir: "/Users/you/.localgithub/repos"
read_only: false
mdns_enabled: false
# Authentication (optional)
auth_enabled: true
auth_user: "git-user"
auth_password_hash: "salt:hash..."LGH supports multiple ways to expose your local service to the internet:
# Show all available tunnel methods
lgh tunnel
# Use ngrok
lgh tunnel --method ngrok
# Use Cloudflare Tunnel
lgh tunnel --method cloudflared
# SSH reverse proxy
lgh tunnel --method ssh
β οΈ Security Note: Always enable authentication (lgh auth setup) or use a reverse proxy before exposing to the internet.
# 1. Setup auth
lgh auth setup
# 2. Bind to all interfaces with read-only mode
lgh serve --bind 0.0.0.0 --read-only --mdns
# 3. Access from other devices (requires auth)
git clone http://username:password@your-hostname.local:9418/repo.git# 1. LGH listens on localhost only
lgh serve
# 2. Use Caddy reverse proxy + auto HTTPS
# Caddyfile:
# git.example.com {
# basicauth * {
# user $2a$14$...
# }
# reverse_proxy localhost:9418
# }# Temporarily expose for GitHub Actions
lgh auth setup
lgh tunnel --method ngrok &
# Use ngrok URL + credentials| Feature | LGH | GitLab | Gitea | git daemon | File Sharing |
|---|---|---|---|---|---|
| Setup Complexity | β Single binary | β Needs database | β Simple | β No install | |
| HTTP Protocol | β | β | β | β | β |
| Authentication | β Optional | β Required | β Required | β | β |
| Web UI | β | β | β | β | β |
| Resource Usage | β <10MB | β >1GB | β <5MB | β None | |
| Startup Time | β <1s | β >30s | β <1s | β Instant | |
| LAN Discovery | β mDNS | β | β | β | β |
| Use Case | Local/Temp | Enterprise | Team | Simple share | File transfer |
LGH's Position: Fills the gap between "simple file sharing" and "full Git platform".
# Run all tests
go test ./... -v
# Run integration tests
go test ./test/... -v
# Skip long-running tests
go test ./... -v -short- Go 1.23+ (for building)
- Git (runtime)
- macOS, Linux, or Windows
Contributions are welcome! See CONTRIBUTING.md for details.
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Create Pull Request
This project is licensed under the MIT License - see LICENSE file.
- spf13/cobra - CLI framework
- spf13/viper - Configuration management
- fatih/color - Terminal coloring
- hashicorp/mdns - mDNS support
Made with β€οΈ by JoeGlenn1213