# git-remote-iroh A git remote helper that transports the git pack protocol over [iroh](https://iroh.computer/) QUIC, enabling peer-to-peer git push and fetch without a centralized server. ## How it works git-remote-iroh acts as a bridge between git's remote helper protocol and iroh's peer-to-peer QUIC transport. It has two modes: - **Server mode** — listens for incoming iroh connections and spawns `git-receive-pack` or `git-upload-pack` to handle push/fetch requests against a local bare repository. - **Remote helper mode** — invoked automatically by git when you use an `iroh://` remote URL. It connects to the peer via iroh QUIC, sends the operation type, and pipes the git pack protocol over the connection. Each node has a persistent identity (an iroh keypair stored at `~/.git-remote-iroh/secret_key`). The public key serves as the node's address — no DNS, no IP addresses, no accounts. ``` git push/fetch iroh QUIC git-receive-pack ──> remote_helper.rs ────> P2P network ────> server.rs ──> git-upload-pack (client) (peer) ``` ## Install Requires Rust and git. ```sh cargo install --path . ``` This places `git-remote-iroh` on your PATH, which is all git needs to recognize `iroh://` remote URLs. ## Usage ### Start a server On the machine hosting the bare repo: ```sh git-remote-iroh serve /path/to/repo.git ``` This prints the node ID and waits for connections: ``` node_id: ad3a791627b4bc96e1ce891f6efbb08b1247ce27cbbfaaf0b5cdbdfb0f022725 remote URL: iroh://ad3a791627b4bc96e1ce891f6efbb08b1247ce27cbbfaaf0b5cdbdfb0f022725 waiting for connections... (ctrl-c to stop) ``` ### Push and fetch On any other machine with `git-remote-iroh` installed: ```sh git remote add peer iroh://ad3a791627b4bc96e1ce891f6efbb08b1247ce27cbbfaaf0b5cdbdfb0f022725 git push peer main git fetch peer ``` Standard git commands work — the remote helper handles the iroh transport transparently. ### Show your node info ```sh git-remote-iroh info ``` Prints your node's public key and the `iroh://` URL others would use to connect to you. ## Project structure ``` src/ ├── main.rs # CLI: serve, info, and remote-helper entry points ├── remote_helper.rs # Git remote helper protocol (client side) ├── server.rs # Iroh protocol handler (server side) ├── protocol.rs # GitOp enum and ALPN constant (git/iroh/0) ├── config.rs # Persistent keypair management └── lib.rs # Module exports tests/ └── push_fetch_test.rs ``` ## Debugging Set `RUST_LOG` for verbose output: ```sh RUST_LOG=debug git push peer main ```