Git mirror server in Go. Clones repos as --mirror, serves them via git http-backend (CGI), and updates them in background goroutines. Three files: main.go (server), config.go (TOML config), mirror.go (git operations).
- Use red/green TDD: write failing tests first, then implement to make them pass
go test && go vet ./... && gofmt -s -l .- Keep
example-config.tomlin sync with config struct changes - Old config fields must be silently ignored (TOML decoder drops unknown keys) — log a deprecation warning instead of erroring
- Update this AGENTS.md and README.md if you find information here outdated.
- All maintenance git operations (
commit-graph write,multi-pack-index write) must be safe for concurrent HTTP readers — no deleting pack files. Never usegit repack -din the serving path. - Background goroutines run one per repo with no parallelism within a repo, but
git http-backendserves concurrent reads on the same repo directory simultaneously.
This project is developed in https://github.com/espressif/git-mirror-server. Only create PRs to this repo.
When creating or updating a PR, request a review from copilot (gh pr edit --add-reviewer copilot or pass --reviewer copilot on create). After the review is posted, read the comments (gh api repos/espressif/git-mirror-server/pulls/<number>/comments), address any relevant findings, and push fixes before notifying the user.