---
title: "Organizations and repositories"
description: "One forge hosts many organizations, each isolated from every other, at its own host name and with its own identity provider, people, roles, keys and runners. Each organization holds its repositories."
---

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

# Organizations and repositories

One forge hosts many organizations, as GitHub does. Each is isolated from every other: nothing of one is named, read or shared by another, not even stored objects with the same contents, since a shared copy would tell one tenant what another stores. Each organization holds its own repositories.

| Level | Holds |
| --- | --- |
| The platform | The cluster's nodes, its organizations and their records, and the platform administrators |
| An organization | Its identity provider, people and the agents born under them, roles, restricted folders and grants, runners, keys and reports |
| A repository | `main`, changes, jj's operation log, objects and test jobs |

Each level is a Raft group of its own with a receipt log of its own, and each organization signs with its own keys.

## People

The forge keeps no accounts. A person belongs to one organization, signed in through that organization's identity provider; someone in two organizations has two identities, and leaving a provider ends every access it gave. Roles (reader, writer, approver, administrator) are the organization's and hold across its repositories. A runner belongs to one organization too, enrolled by its administrators, and runs only its jobs, since its sandbox shares one kernel and its machine one cache.

## Organizations

The **platform administrators** are the administrators of the operator's organization, the one the cluster's first start creates (`operator`, unless `--organization` names it). They create every other organization. Being one grants nothing inside any other organization.

Each organization has its own host name under the forge's domain, given with `af-server --domain`: with `--domain forge.example`, organization `acme` is served at `acme.forge.example`, under one wildcard certificate. The host names the organization before anyone signs in, and each connection acts inside one organization. Without a domain, every host name reaches the operator's organization.

A platform administrator creates an organization with its identity provider and its first administrator, connected to the operator organization's host:

```sh
af create-organization acme \
    --issuer https://accounts.google.com --client-id <CLIENT_ID> --tenant hd=acme.example \
    --first-administrator ada@acme.example
```

Another platform administrator approves the request, unless there is only one. For an issuer many organizations share, such as Google's or Microsoft Entra ID's, `--tenant` pins the claim that names this organization, and only tokens that carry it are accepted. The organization's first administrator becomes its administrator when they first sign in, at its own host:

```sh
af --address acme.forge.example:7777 auth
```

### Second factors

Every sign-in needs a second factor. The forge reads it from the token's `amr` claim, RFC 8176's authentication methods: `--second-factor` names the values that count, `mfa` unless set. For a provider whose tokens do not say how a person signed in, the operator can instead declare that the provider requires a second factor for every sign-in, with `--second-factor-by-policy`. Each sign-in's record says whether its second factor was reported or rests on that declaration, and a token that says how a person signed in, without a second factor, is refused either way.

## Repositories

An organization's administrator creates a repository, on their own word, unless the forge requires a second administrator to approve it (`af-server --two-administrators`). On a development forge it takes effect at once:

```console server
$ af-server --dev
...
```

```console check
$ source ~/af-dev/dev/env
$ af create-repository web --reason "the web front end"
done: it took effect at once, on your word as an administrator
$ af --repository web workspace add ~/web
Workspace at /home/you/web
Paths: **
main has no landing yet
```

A repository names its objects in SHA-256, Git's newer hash, unless it is made asking for SHA-1: ids are then 40 hex digits instead of 64, as for a history that must keep the SHA-1 ids it already has. The choice is the repository's for good:

```console check
$ af create-repository legacy --objects sha1 --reason "kept in SHA-1"
done: it took effect at once, on your word as an administrator
```

A workspace records its repository, so `af` run inside it needs no `--repository`. A name is a repository's once, and is letters, digits, `.`, `-` and `_`:

```console check
$ af create-repository web
Error: PermissionDenied: the organization has "web" already
[1]
$ af create-repository 'bad name'
Error: "bad name" is no repository's name: a-z, A-Z, 0-9, ., - and _
[1]
```

A repository is open to the organization's readers and writers unless it is restricted, as a [folder](https://docs.forge.workreef.dev/concepts/permissions/) is: a repository is the first part of each of its paths. To bring a Git repository in with its history, see [Moving from Git](https://docs.forge.workreef.dev/start/from-git/).

## Next

- [Start a forge](https://docs.forge.workreef.dev/server/start/): the operator's organization and its first administrator.
- [`af create-organization`](https://docs.forge.workreef.dev/reference/af/create-organization/) and [`af create-repository`](https://docs.forge.workreef.dev/reference/af/create-repository/) in the reference.

Source: https://docs.forge.workreef.dev/server/organizations/index.mdx
