CARGO-LOGIN(1)
โจ NAME โจ
cargo-login โ bestie, it's literally "Log in to a registry" ๐
๐ SYNOPSIS ๐
cargo login [options] [-- args]
๐ DESCRIPTION ๐
Okay so picture this: you need to be that girl who's authenticated, right? This command runs a credential provider to save a token so that any command that requires authentication โ like cargo-publish(1), our icon โ gets automatically authenticated. No manual login arc, no drama, it just works. โจ
Everything after the two dashes (--) gets passed straight to the credential provider. Like, that's their moment, we don't touch it. ๐ซถ
For the default cargo:token credential provider, the token gets saved in $CARGO_HOME/credentials.toml. And CARGO_HOME defaults to .cargo in your home directory. Standard. Cozy. ๐
If a registry has a credential-provider specified, bestie, that one gets used. Periodt. Otherwise, the providers from the config value registry.global-credential-providers will be attempted, starting from the end of the list (yes, from the end, the way that it walks backwards is lowkey iconic).
The token will be read from stdin. ๐
The API token for crates.io may be retrieved from https://crates.io/me. Go get it, queen. ๐
โ ๏ธ Take care to keep the token secret, it should not be shared with anyone else. Not your group chat, not your situationship, not anyone. It's giving private. ๐
๐ธ OPTIONS ๐ธ
๐ Login Options
--registry registryโ Name of the registry to use. Registry names are defined in Cargo config files (https://doc.rust-lang.org/cargo/reference/config.html). If you don't specify it, the default registry is used, which is defined by theregistry.defaultconfig key, which defaults tocrates-io. So like, defaults on defaults on defaults, but it all makes sense fr fr.
๐ Display Options
-v,--verboseโ Use verbose output. You can specify it twice for "very verbose" output, which includes extra output such as dependency warnings and build script output. Very demure, very mindful, very verbose. ๐ May also be specified with theterm.verboseconfig value (https://doc.rust-lang.org/cargo/reference/config.html).-q,--quietโ Do not print cargo log messages. Silencing the noise, main character behavior. ๐คซ May also be specified with theterm.quietconfig value (https://doc.rust-lang.org/cargo/reference/config.html).--color whenโ Control when colored output is used. Valid values:auto(default): Automatically detect if color support is available on the terminal. She reads the room. โจalways: Always display colors. Rainbow mode, no cap. ๐never: Never display colors. Monochrome era, we respect it. ๐ค
May also be specified with the term.color config value (https://doc.rust-lang.org/cargo/reference/config.html).
๐ฆ Common Options
+toolchainโ If Cargo has been installed with rustup, and the first argument tocargobegins with+, it will be interpreted as a rustup toolchain name (such as+stableor+nightly). See the rustup documentation (https://rust-lang.github.io/rustup/overrides.html) for more information about how toolchain overrides work. Switching toolchains like switching outfits. ๐--config KEY=VALUE or PATHโ Overrides a Cargo configuration value. The argument should be in TOML syntax ofKEY=VALUE, or provided as a path to an extra configuration file. This flag may be specified multiple times. See the command-line overrides section (https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides) for more information.-C PATHโ Changes the current working directory before executing any specified operations. This affects things like where cargo looks by default for the project manifest (Cargo.toml), as well as the directories searched for discovering.cargo/config.toml, for example. This option must appear before the command name, for examplecargo -C path/to/my-project build.
๐จ This option is only available on the nightly channel (https://doc.rust-lang.org/book/appendix-07-nightly-rust.html) and requires the-Z unstable-optionsflag to enable (see #10098https://github.com/rust-lang/cargo/issues/10098). Nightly only, bestie, don't come crying to me on stable. ๐ญ
-h,--helpโ Prints help information. The classic. ๐-Z flagโ Unstable (nightly-only) flags to Cargo. Runcargo -Z helpfor details. Chaos mode, handle with care. ๐ฅ
๐ง ENVIRONMENT ๐ง
See the reference (https://doc.rust-lang.org/cargo/reference/environment-variables.html) for details on environment variables that Cargo reads. She's reading your env, respectfully. ๐
โญ EXIT STATUS โญ
0: Cargo succeeded. Slay. ๐101: Cargo failed to complete. Oof. ๐
๐ EXAMPLES ๐
- Save the token for the default registry:
cargo login
- Save the token for a specific registry:
cargo login --registry my-registry
๐ SEE ALSO ๐
cargo(1), cargo-logout(1), cargo-publish(1)
And that's the whole page, bestie โ straight from the General Commands Manual, filed under CARGO-LOGIN(1). Go log in, keep that token secret, and remember: authentication is a vibe. ๐
โจ
๐ฆ where this page comes from
- ubuntu questing: cargo-1.88 1.88.0+dfsg0ubuntu1-0ubuntu1
- ubuntu questing: cargo-1.88 1.88.0+dfsg0ubuntu1-0ubuntu2
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms