Skip to content

Configuration

copit uses a copit.toml file to track your project's target directory and all copied sources.

File format

target = "vendor"

[[sources]]
path = "vendor/prek-identify"
source = "github:j178/prek@master/crates/prek-identify"
ref = "master"
commit = "abc123def456..."
copied_at = "2026-03-07T08:46:51Z"
excludes = ["Cargo.toml", "src/lib.rs"]

Fields

Root-level fields

Field Description
target Default directory where source files are copied into
overwrite Default: overwrite existing files without prompting
skip Default: skip existing files without prompting
backup Default: save .orig backup for excluded modified files
licenses_dir Centralized directory for license files. When set, licenses are stored in {licenses_dir}/{relative_path}/ (mirroring the target structure) instead of next to the source files

[registries.<name>]

A configured registry, keyed by the name used in @name/component. See Registries.

Field Description
source Where the registry lives: github:owner/repo@ref, or a local directory
index Index filename within the source; defaults to copit-registry.json
target Dedicated directory for this registry's components; falls back to the project target
variants Registry-defined variants to select, e.g. ["postgres"]
optional Optional groups every component of this registry installs, e.g. ["tests"]
package_manager Manager to use; detected when unset. "none" never installs
[registries.my-kit]
source = "github:owner/repo@v1.0.0"
target = "app/components"
variants = ["postgres"]
optional = ["tests"]
package_manager = "uv"

variants and optional are defaults for the whole registry, named after the index keys they select from. On add, --variant and --with replace them for that install, and --no-optional takes no groups at all.

[[sources]]

Each entry in the sources array represents one copied source:

Field Description
path Local path where the source was copied
source Original source string used to fetch the file
ref User-specified version string (branch, tag, or SHA)
commit Resolved commit SHA from GitHub API (GitHub sources only)
copied_at Timestamp of when the source was last copied
excludes List of relative paths within the source to skip on re-add. With --backup, the new version is saved as <file>.orig
frozen Pin this source so it's skipped during updates
overwrite Per-source override: overwrite existing files without prompting
skip Per-source override: skip existing files without prompting
backup Per-source override: save .orig backup for excluded modified files
no_license Skip copying license files for this source (set via --no-license on add)
component Registry component this path came from, as registry:id. Set when installed from a registry, and how copit knows which components are already present when resolving dependencies
component_version The component's own version from the index. Distinct from ref, the registry tag that covers every component in a monorepo registry
variants Variants selected when this component was installed, so update reproduces the same file selection
optional Groups selected on install, so update reproduces them. Absent falls back to the registry's optional; [] means --no-optional

Settings priority: CLI flags > per-source config > root-level config > default (false).

License auto-copy

When adding or updating GitHub sources, copit automatically copies LICENSE files from the repository root alongside your source files. By default, licenses are placed side-by-side with the copied source:

  • Single file — license is placed in a stem-named subfolder (e.g. vendor/lib.rs → vendor/lib/LICENSE)
  • Directory — license is placed inside the copied directory (e.g. vendor/mylib/ → vendor/mylib/LICENSE)

To skip license copying, use --no-license with add. This sets no_license = true on the source entry, so subsequent update and update-all calls also skip licenses for that source.

To centralize all license files in one directory, set licenses_dir in copit.toml:

target = "vendor"
licenses_dir = "licenses"

This stores licenses mirroring the target structure:

Source path License path
vendor/mylib/ (directory) licenses/mylib/LICENSE
vendor/lib.rs (single file) licenses/lib/LICENSE
vendor/utils/helpers.rs licenses/utils/helpers/LICENSE

Use copit licenses-sync to reorganize existing license files when changing this setting.