mirror of
https://github.com/imjasonh/infinite-git
synced 2026-07-09 01:25:33 +00:00
No description
- Add Terraform configuration using regional-go-service module - Configure Artifact Registry for container images - Set up networking infrastructure - Deploy service with public access enabled - Add Terraform files to .gitignore The service is now deployed at: https://infinite-git-nd2dq3gc7a-uk.a.run.app 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| iac | ||
| internal | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| main.go | ||
| main_test.go | ||
| plan.md | ||
| README.md | ||
| test.sh | ||
Infinite Git
A Git HTTP server that generates a new commit every time someone pulls from the repository.
Features
- Implements Git smart HTTP protocol for read-only access
- Generates a unique commit on every pull/clone operation
- Thread-safe commit generation
- Persistent Git repository on disk
- Structured logging with slog
Installation
go install github.com/imjasonh/infinite-git/cmd/infinite-git@latest
Or build from source:
git clone https://github.com/imjasonh/infinite-git
cd infinite-git
go build -o infinite-git ./cmd/infinite-git
Usage
Start the server:
infinite-git
Configuration via environment variables:
PORT: HTTP server port (default: "8080")REPO_PATH: Path to Git repository (default: "./infinite-repo")
Example:
PORT=3000 REPO_PATH=/tmp/my-infinite-repo infinite-git
Logging is configured via the standard clog environment variables.
Testing
Clone the repository:
git clone http://localhost:8080
Every time you pull, you'll get a new commit:
cd <cloned-repo>
git pull origin main
# New commit appears!
How It Works
- When a client initiates a pull/clone, the server intercepts the reference discovery request
- Before advertising refs, it generates a new commit with:
- A unique file containing the pull counter and timestamp
- A commit message indicating when the pull occurred
- The new commit is added to the main branch
- The updated refs are sent to the client
- The client receives the new commit as part of the normal Git protocol flow
Implementation Details
- Uses Git plumbing commands (
git add,git commit) to create commits - Implements pkt-line format for Git protocol communication
- Delegates object transfer to
git upload-packfor efficiency - Rejects all push attempts with 403 Forbidden
License
MIT