---
title: "Repositories and builds"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ermahgerd.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Repositories and builds

Store organization-owned source code and other versioned files in an authenticated
Git repository. Repositories are independent resources: one repository may contain
one Worker, several Workers, or no Worker project.

Use a repository build when a push to a selected production branch should be
the release event. Use [direct Wrangler deployment](/build/workers/) when
your existing shell or CI release process should publish the Worker itself.
Both paths produce the same immutable Worker version and retain the same
deployment history.

## Build and publish from a push

1. Open **Data → Repositories**, create a repository, and retain its initial
   write token when shown.

2. Open the repository's **Deployments** tab and select **Connect Worker**.
   Choose a Worker name, production branch, and project root. The Worker is
   created on the first successful publication when it does not already exist.

3. Commit a Worker project with `wrangler.jsonc`, `package.json`, and
   `package-lock.json`. For example:

   ```jsonc
   {
     "name": "my-worker",
     "main": "src/index.ts",
     "compatibility_date": "2026-11-08"
   }
   ```

4. Push the configured branch. The platform records the ref update and starts a
   build for that exact commit. A successful build is revalidated, then published
   to the connected Worker. The **Deployments** tab records the commit, build
   output, and resulting Worker publication separately.

The initial `plain-worker@1` build profile supports JavaScript and TypeScript
Workers, integrity-locked ordinary npm dependencies, declared static assets,
D1, queues, Cron Triggers, variables, observability, and the supported telemetry
binding. It deliberately accepts `wrangler.jsonc`, not TOML, and requires a
committed `package-lock.json`; TypeScript project configuration files are not yet
supported. Unsupported configuration fails the build rather than publishing a
partial Worker. The selected production branch, optional monorepo project root,
build-pack version, target Worker, and whether automatic publication is enabled
are saved on the repository connection. The committed Wrangler configuration
remains the source of truth for the Worker itself.

Builds execute in a bounded, disposable workerd slot. The slot receives one
immutable source snapshot and has no tenant, repository, deployment, or provider
credential. It has no arbitrary egress; locked package dependencies use the
platform's narrow, credential-free registry service. A separate trusted
publisher is the only component that can turn a successful artifact into a
Worker deployment.

To investigate a failed build, open its commit in **Build history**. The detail
keeps bounded compiler output, the failure, and lifecycle activity at a
shareable URL. Canceling a queued or running build stops only that build; it
does not roll back the active Worker version.

## Use Git transport

Open **Data → Repositories** in the tenant console. Create a repository, copy its
HTTPS remote, and save the initial write token when it is shown. The token is shown
only once.

Each organization has one tenant-scoped Git origin:
`https://<organization-namespace>.git.<platform-base-domain>/`. Repositories
use ordinary `.git` paths beneath it. Repository names use
lowercase letters, digits, and internal hyphens. The platform provisions HTTPS
for the organization origin automatically; creating another repository does not
require another hostname or certificate.

The **Repository** page browses branches, directories, and text files and contains
the **Clone** control beside branch selection. Directory rows identify the most
recent change to each entry. A directory README is rendered below its file list;
raw HTML is ignored and repository-relative links stay inside the browser. Use
**History** for the selected repository path to inspect its bounded commit history
or open the tree at an exact commit. The selected branch, commit, path, and history
page are refresh-safe and can be shared as deep links. Binary files and Git
submodules are identified without being rendered; text previews are bounded to
256 KiB. **Tokens** owns Git credentials; **Settings** contains lifecycle metadata
and deletion. These are separate, refresh-safe pages.

Use the token as the HTTPS password with any username. For a non-interactive clone,
configure an authorization header without putting the token in the remote URL:

```sh
git -c http.extraHeader="Authorization: Bearer $ERMAHGERD_REPOSITORY_TOKEN" \
  clone "$ERMAHGERD_REPOSITORY_URL"
```

Add the copied remote to an existing checkout and push normally:

```sh
git remote add ermahgerd "$ERMAHGERD_REPOSITORY_URL"
git -c http.extraHeader="Authorization: Bearer $ERMAHGERD_REPOSITORY_TOKEN" \
  push ermahgerd main
```

Set `ERMAHGERD_REPOSITORY_URL` to the remote shown by the console. A
self-hosted installation uses its configured Git domain. Repository management
continues to use the authenticated control-plane API; cloning and pushing use
the repository hostname.

## Repository tokens

Create separate tokens for people and automation instead of sharing the initial
credential. A read token can clone and fetch. A write token can also push ref and
object updates. Every token has a name and expiry and can be revoked immediately
from the repository's **Tokens** page. Initial credentials expire after one hour.
The page retains revoked credentials as lifecycle evidence and shows the last time
an active credential authenticated Git transport; plaintext is never retained or
shown again.

Tokens belong to one repository and one organization. They do not grant console,
direct deployment-API access, or access to another repository. A write token can
trigger the repository's explicitly saved Worker connection by pushing its selected
branch. HTTPS is the supported Git transport; SSH keys and SSH Git transport are not
currently available. Commit and tag signing remain ordinary Git content and are
independent of transport access.

## Storage and execution boundary

Git protocol and pack processing run as WebAssembly inside stock workerd. Each
repository has a stable SQLite-backed Durable Object identity. Objects are addressed
by their canonical Git hashes, chunked in SQLite, and deduplicated within the
repository.

Repositories share fixed data-service capacity. They are single-region and are not
replicated or automatically migrated. The initial limit is 32 MiB of retained Git
object data per repository, with an 8 MiB request limit. Organization repository
count, aggregate retained bytes, and Git operations appear under **Usage & limits**.
Growth is reserved through the quota service before pack processing.

Repository lifecycle and Git operations emit organization-scoped operational
evidence including outcome, duration, request and response bytes, retained bytes,
Wasm memory, and each accepted branch or tag ref change. Tokens are never written
to this evidence. Ref-change evidence is observability data; it is not yet a durable
queue subscription.

## Worker binding

Declare an Artifacts binding through Wrangler to give one Worker a tokenless,
organization-scoped repository capability:

```jsonc
{
  "artifacts": [{ "binding": "ARTIFACTS", "namespace": "default" }]
}
```

The trusted runtime supplies organization identity and the repository service
credential outside application code. `env.ARTIFACTS` supports repository create,
get, list, and delete; repository handles support metadata, expiring token create,
token list and revocation, and MIME-typed `readFile({ ref, path })` access. Handles
are disposable and repository operations never allow a Worker to choose another
organization. Repository import, fork, commit-log traversal through the Worker
binding, and low-level Git object reads are not implemented yet. The
The binding lets a Worker read files without a separate repository token.

## Manage a Worker build connection

A Repository can be explicitly connected to a new or existing Worker. The connection
selects one production branch, an optional monorepo project root, and a versioned
build pack. It is not an implicit side effect of creating a Repository:
repositories that are not connected remain ordinary Git resources.

Open **Data → Repositories → your repository → Deployments** to connect a Worker.
The same page shows the exact commits built from Git pushes and keeps build and
publication outcomes distinct. Pausing a connection leaves the Worker and its
active version unchanged; it only stops future pushes from starting deployments.

Select a commit in **Build history** to inspect that build's full failure detail,
retained output, and lifecycle activity. Each build has a shareable URL; browser
Back returns to the same history page. The history loads ten builds per page by
default, with larger page sizes available. Build and deployment state refresh
automatically. Output is retained when execution finishes, not streamed live.
Owners and members with write access can cancel a queued or running build. This
does not roll back an existing Worker deployment or cancel publication of an
already successful build.

After the connection is enabled, pushing the selected branch records the accepted
ref update and a build trigger in one durable transaction. The platform builds the
exact commit in a bounded, credential-free workerd executor. A successful build is
then claimed by a separate trusted publisher, revalidated by the control plane, and
deployed to the connected Worker. Repeated delivery of the same push or a lost
publication response does not create another build or Worker version.

Static files declared by Wrangler are published through the platform asset
service with the resulting immutable Worker version. Cron Triggers and queue
consumers are validated against the organization's resources before a Worker
version is created, then their complete desired sets are reconciled after the new
version becomes active. Removing an activation declaration from Wrangler
configuration removes that connection-owned trigger on the next successful
publication.

Repository imports, forks, and browser editing remain follow-on capabilities.
Console browsing is read-only and does not create commits or modify refs.

Source: https://docs.ermahgerd.io/build/repositories/index.mdx
