← 返回命令列表

Linux command

cargo-login 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Login to crates.io

cargo login

Login with a token provided as argument

cargo login [token]

Login to a specific registry

cargo login --registry [my-registry]

说明

cargo login runs a credential provider to save a token for registry authentication. Required for publishing crates with `cargo publish`. The token is read from stdin. Tokens are stored in `$CARGO_HOME/credentials.toml` by default. For crates.io, obtain your token from https://crates.io/me

参数

--registry _name_
Registry to authenticate with (default: crates-io)
-v, --verbose
Verbose output. May be specified twice for extra detail.
-q, --quiet
Suppress output.
--color _when_
Control colored output (auto, always, never).
--config _KEY=VALUE_
Override a Cargo configuration value.

FAQ

What is the cargo-login command used for?

cargo login runs a credential provider to save a token for registry authentication. Required for publishing crates with `cargo publish`. The token is read from stdin. Tokens are stored in `$CARGO_HOME/credentials.toml` by default. For crates.io, obtain your token from https://crates.io/me

How do I run a basic cargo-login example?

Run `cargo login` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --registry _name_ do in cargo-login?

Registry to authenticate with (default: crates-io)