Pass a config key or file path at runtime.
Section: Cargo config
Override config on one command
bash
bash
cargo --config build.target-dir="target-ci" testExplanation
Cargo supports `--config KEY=VALUE` or a config path on the command line.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Cargo config
Create project-local Cargo config
Store configuration in the project under `.cargo/config.toml`.
Set target dir by environment variable
Redirect build artifacts without editing config files.