CLI Reference
Global Options
Section titled “Global Options”These flags can be placed before any command:
kod [global options] <command> [options]
-t, --token <token> API token for authentication -s, --server <url> Server URL (default: http://localhost:3000) -h, --help Show help -v, --version Show versionkod init
Section titled “kod init”Configure the CLI client interactively. Saves settings to ~/.kod/config.json.
kod initWhen prompted for the API token, enter the same token used with --admin-token when starting the server.
If git-credential-kod is available on your PATH (installed automatically with npm install -g kod), kod init also configures Git to use it as a credential helper for the server host. This means plain git clone, git push, and git pull will authenticate automatically.
git-credential-kod
Section titled “git-credential-kod”A Git credential helper that reads your Kod token from ~/.kod/config.json and provides it to Git automatically. Installed alongside the kod binary.
You normally don’t need to invoke this directly — kod init configures Git to use it. To set it up manually:
git config --global credential.http://localhost:3000.helper kodkod serve
Section titled “kod serve”Start the Kod server.
kod serve [options]
Options: --port, -p <port> Port to listen on (default: 3000) --data-dir <path> Data directory for database --repos-dir <path> Directory for Git repositories --token <token> Legacy bootstrap token alias --admin-token <token> Admin token for first-time setup --encryption-key <key> Encryption key for secrets --ssh / --no-ssh Enable or disable SSH Git access --ssh-host <host> SSH listen host (default: 0.0.0.0) --ssh-port <port> SSH listen port (default: 2222) --ssh-host-key <path> SSH host private key path --ssh-anonymous-read Allow anonymous read-only SSH clone/fetch/listEnvironment variables:
| Variable | Description |
|--------------------------|----------------------------------|
| KOD_PORT | Port to listen on |
| KOD_DATA_DIR | Data directory |
| KOD_REPOS_DIR | Repos directory |
| KOD_API_TOKEN | Legacy bootstrap token alias |
| KOD_ADMIN_TOKEN | Admin token for first-time setup |
| KOD_ENCRYPTION_KEY | Encryption key for secrets |
| KOD_SSH_ENABLED | Enable SSH server (true/false) |
| KOD_SSH_HOST | SSH listen host |
| KOD_SSH_PORT | SSH listen port |
| KOD_SSH_HOST_KEY_PATH | SSH host private key path |
| KOD_SSH_ANONYMOUS_READ | Allow anonymous SSH read access |
kod clone
Section titled “kod clone”Clone a repository using your configured token.
kod clone <repo-name>kod clone <url>kod clone my-app --credentials kod_other_tokenkod repo
Section titled “kod repo”Manage repositories.
kod repo list # List all repositorieskod repo create <name> # Create a new repositorykod repo import <source> [name] # Import a local or remote Git repositorykod repo <name> info # Show repository detailskod repo update <name> name <new> # Rename a repositorykod repo delete <name> # Delete a repositorykod repo <name> protected # List protected brancheskod repo <name> protect <branch> # Protect a branchkod repo <name> unprotect <branch> # Remove branch protectionCollaborators
Section titled “Collaborators”kod repo <name> collaborator list # List collaboratorskod repo <name> collaborator add <username> # Add collaboratorkod repo <name> collaborator remove <username> # Remove collaboratorWebhooks
Section titled “Webhooks”kod repo <name> webhook listkod repo <name> webhook add <url> [--events push,workflow] [--secret <secret>]kod repo <name> webhook deliveries <id>kod repo <name> webhook retry <id> <delivery-id>kod repo <name> webhook remove <id>Webhook events are delivered as JSON with X-Kod-Event and X-Kod-Delivery. When a secret is configured, Kod also sends X-Kod-Signature-256. Failed deliveries are retried automatically and can be retried manually.
kod keys
Section titled “kod keys”Manage SSH public keys for collaborator-linked tokens.
kod keys listkod keys add ~/.ssh/id_ed25519.pub [--name laptop]kod keys remove <id>Admins can manage another collaborator’s keys with --username <user>.
kod doctor
Section titled “kod doctor”Check local Git availability, client/server configuration, server health, and API authentication.
kod doctorkod token
Section titled “kod token”Manage API tokens (requires admin permission).
kod token list # List all tokenskod token create <name> [options] # Create a new tokenkod token delete <id> # Delete a tokenCreate options:
--permissions <perms> Comma-separated permissions (default: repo:read,repo:write,workflow:read)--expires <days> Token expiration in days (1-365)--username <user> Link token to a collaborator (for Git access)Examples:
kod token create ci-deploy --permissions repo:read,workflow:triggerkod token create alice --username alice --permissions repo:read,repo:writekod token create temp --expires 30kod token create full-admin --permissions adminkod workflow
Section titled “kod workflow”Run workflows locally or check status.
kod workflow <file.toml> [file2.toml...] # Run workflow(s) locallykod workflow status [repo] # Check workflow statuskod workflow show <repo> <id> # Show a runkod workflow trigger <repo> [--branch b] # Trigger a remote runExamples:
kod workflow build.tomlkod workflow build.toml deploy.tomlBRANCH=main kod workflow build.tomlkod workflow statuskod workflow status my-repokod workflow show my-repo abc123kod workflow trigger my-repo --branch mainkod backup
Section titled “kod backup”Create a portable archive containing the configured data and repository directories.
kod backupkod backup --output kod-backup.tar.gzkod restore
Section titled “kod restore”Restore a backup into the configured data and repository directories. Restore refuses to overwrite non-empty targets unless --force is provided.
kod restore kod-backup.tar.gzkod restore kod-backup.tar.gz --forcekod upgrade
Section titled “kod upgrade”Upgrade Kod to the latest version.
kod upgradekod uninstall
Section titled “kod uninstall”Remove Kod from your system. Deletes the binary (~/.local/bin/kod) and data directory (~/.kod). Prompts for confirmation before proceeding.
kod uninstallPermissions
Section titled “Permissions”| Permission | Description |
|----------------------|------------------------------------|
| repo:read | Clone and fetch repositories |
| repo:write | Push to repositories |
| repo:delete | Delete repositories |
| collaborator:read | List collaborators |
| collaborator:write | Add/remove collaborators |
| workflow:read | View workflow status and history |
| workflow:trigger | Trigger workflows via API |
| secrets:read | List secret names (no values) |
| secrets:write | Create, update, and delete secrets |
| webhook:read | List repository webhooks |
| webhook:write | Create and delete webhooks |
| admin | Full access to all operations |