Repositories
A repository lives in a workspace. A slug is unique inside a workspace and not across them, so a slug that several workspaces hold asks for --workspace <id>. Each command uses the environment that the last district login recorded, the one an environment flag names, or production.
district repo create
district repo create <name> [--slug <slug>] [--description <text>] [--workspace <id>] [--clone] [--production | --staging | --dev]
Creates a repository and prints its slug, repo_ id and HTTPS git remote URL on stdout. The repository is created in the workspace the caller can open. A caller who can open several workspaces names one with --workspace <id>, and the error lists them.
Without --slug, district-api derives the slug from the name. A slug that a live repository of the workspace already uses is refused with the API's message.
--clone then clones into ./<slug> without asking. Without --clone, an interactive session asks Clone into ./<slug>? [Y/n], and an empty answer clones. A session with no terminal prints the git clone command to run instead, because an agent cannot answer. The clone never asks for a password: without the helper, git fails at once and the message names the fix, district git-credential install.
Arguments
| Argument | Description |
|---|
<name> | The display name of the repository. Without --slug, district-api derives the slug from it. |
Flags
| Flag | Description | Default |
|---|
--slug <slug> | The slug of the repository, which names it inside its workspace. | derived from the name |
--description <text> | A description of the repository. | - |
--workspace <id> | The workspace to create the repository in, when the caller can open several. | - |
--clone | Clones into ./<slug> without asking. | false |
--production | --staging | --dev | The environment to act in. Pass one at most. Without a flag, the command uses the environment that the last district login recorded, or production. | - |
Output
$ district repo create "My App" --clone
created my-app (repo_01K4…)
remote https://…/repo_01K4….git
cloning into ./my-app
Exit codes
| Exit code | Meaning |
|---|
| 0 | The repository is created. |
| 1 | The API refused the call with its own message, such as a slug that a live repository of the workspace already uses, or git did not clone the repository. |
| 2 | The caller can open several workspaces and no --workspace <id> names one. |
district repo list
district repo list [--workspace <id>] [--first <n>] [--json] [--production | --staging | --dev]
Prints a header row, then one row per repository of one workspace, most recent activity first: the slug, the repo_ id, the display name, the kind, and when it was created. No clone is read: the list belongs to a workspace, not to the directory the command runs in.
The workspace is the one the caller can open. A caller who can open several workspaces names one with --workspace <id>, and the error lists them.
A repository that belongs to an applet is not listed: the applet owns it and deletes it with itself. A workspace with no repository prints nothing and exits 0.
Flags
| Flag | Description | Default |
|---|
--workspace <id> | The workspace to list, when the caller can open several. | - |
--first <n> | Reads n repositories, from 1 to 100. | 30 |
--json | Prints the rows as one JSON array, each with the description, the default branch and the remote URL as well. | false |
--production | --staging | --dev | The environment to act in. Pass one at most. Without a flag, the command uses the environment that the last district login recorded, or production. | - |
Output
$ district repo list
SLUG REPOSITORY NAME KIND CREATED
my-app repo_01K4X0J8W1QZ5B7N3G2R6TQ9YD My App hosted_app 2026-08-25T09:00:00Z
shopfront repo_01K4X0J8W1QZ5B7N3G2R6TQ9YE Shopfront hosted_app 2026-08-24T09:00:00Z
Exit codes
| Exit code | Meaning |
|---|
| 0 | The list was printed. A workspace with no repository also exits 0. |
| 1 | The API refused the call with its own message, or district-api did not answer. |
| 2 | The caller can open several workspaces and no --workspace <id> names one. |
district repo clone
district repo clone <repository> [<directory>] [--workspace <id>] [--production | --staging | --dev]
Resolves a repository by repo_ id or by slug and runs git clone into <directory>, or into ./<slug> without one.
Authentication comes from the installed credential helper, not from the URL. The clone never asks for a password: without the helper, git fails at once and the message names district git-credential install.
Arguments
| Argument | Description | Default |
|---|
<repository> | The repository, by repo_ id or by slug. | - |
[<directory>] | The directory to clone into. | ./<slug> |
Flags
| Flag | Description |
|---|
--workspace <id> | The workspace of the repository, when the same slug names a repository in more than one workspace. |
--production | --staging | --dev | The environment to act in. Pass one at most. Without a flag, the command uses the environment that the last district login recorded, or production. |
Output
$ district repo clone my-app
cloning into ./my-app
Cloning into 'my-app'...
Exit codes
| Exit code | Meaning |
|---|
| 0 | The clone finished. |
| 1 | The API refused the call with its own message, or git did not clone the repository. |
| 2 | The argument names no repository, or a slug that several workspaces hold. |
district repo url
district repo url <repository> [--workspace <id>] [--production | --staging | --dev]
Prints only the repository's HTTPS git remote URL on stdout. It can be used in command substitution. The URL contains the repository id, not its slug, and does not change.
Arguments
| Argument | Description |
|---|
<repository> | The repository, by repo_ id or by slug. |
Flags
| Flag | Description |
|---|
--workspace <id> | The workspace of the repository, when the same slug names a repository in more than one workspace. |
--production | --staging | --dev | The environment to act in. Pass one at most. Without a flag, the command uses the environment that the last district login recorded, or production. |
Output
git clone "$(district repo url my-app)"
Exit codes
| Exit code | Meaning |
|---|
| 0 | The URL was printed. |
| 1 | The API refused the call with its own message, or district-api did not answer. |
| 2 | The argument names no repository, or a slug that several workspaces hold. |
district repo delete
district repo delete <repository> [--workspace <id>] [--yes] [--production | --staging | --dev]
Hides a repository, its remote and every branch it holds for 14 days. The slug stays held. A restoreDeletion call with the printed deletion ID brings them back until the printed time. The purge after the printed time deletes the repository and its remote. The command prints the resolved repository and the environment, then asks Delete <slug>? [y/N].
The repository argument is required, and the clone in the current directory never names it: a command line that named nothing would otherwise delete the remote of the checkout the person is standing in.
A repository that a hosted app, a board or a routine still uses is refused with the API's message, which names the resource to delete first. district app delete removes the app. A member with resource:delete in the workspace can delete a shared repository; only the owner can delete a private one. Every other caller is told the repository was not found.
Arguments
| Argument | Description |
|---|
<repository> | The repository, by repo_ id or by slug. The argument is required. |
Flags
| Flag | Description | Default |
|---|
--workspace <id> | The workspace of the repository, when the same slug names a repository in more than one workspace. | - |
--yes | Skips the "Delete <slug>? [y/N]" question. A session with no terminal needs it. | false |
--production | --staging | --dev | The environment to act in. Pass one at most. Without a flag, the command uses the environment that the last district login recorded, or production. | - |
Output
$ district repo delete my-app --yes
deleted my-app (repo_01K4X0J8W1QZ5B7N3G2R6TQ9YD, deletion del_01K4…, restorable until 2026-09-08T09:00:00Z)
Exit codes
| Exit code | Meaning |
|---|
| 0 | The repository, its remote and every branch it holds are hidden until the printed time. |
| 1 | The confirmation was declined, or the API refused the call with its own message, such as a hosted app or an applet that still uses the repository. |
| 2 | The command line names no repository, a slug that several workspaces hold, or no terminal can confirm. |