1CARGO-LOGIN(1)              General Commands Manual             CARGO-LOGIN(1)
2
3
4

NAME

6       cargo-login — Log in to a registry
7

SYNOPSIS

9       cargo login [options] [token] – [args]
10

DESCRIPTION

12       This command will run a credential provider to save a token so that
13       commands that require authentication, such as cargo-publish(1), will be
14       automatically authenticated.
15
16       For the default cargo:token credential provider, the token is saved in
17       $CARGO_HOME/credentials.toml. CARGO_HOME defaults to .cargo in your
18       home directory.
19
20       If a registry has a credential-provider specified, it will be used.
21       Otherwise, the providers from the config value
22       registry.global-credential-providers will be attempted, starting from
23       the end of the list.
24
25       If the token argument is not specified, it will be read from stdin.
26
27       The API token for crates.io may be retrieved from
28       <https://crates.io/me>.
29
30       Take care to keep the token secret, it should not be shared with anyone
31       else.
32

OPTIONS

34   Login Options
35       --registry registry
36           Name of the registry to use. Registry names are defined in Cargo
37           config files
38           <https://doc.rust-lang.org/cargo/reference/config.html>. If not
39           specified, the default registry is used, which is defined by the
40           registry.default config key which defaults to crates-io.
41
42   Display Options
43       -v, --verbose
44           Use verbose output. May be specified twice for “very verbose”
45           output which includes extra output such as dependency warnings and
46           build script output. May also be specified with the term.verbose
47           config value
48           <https://doc.rust-lang.org/cargo/reference/config.html>.
49
50       -q, --quiet
51           Do not print cargo log messages. May also be specified with the
52           term.quiet config value
53           <https://doc.rust-lang.org/cargo/reference/config.html>.
54
55       --color when
56           Control when colored output is used. Valid values:
57
58auto (default): Automatically detect if color support is
59               available on the terminal.
60
61always: Always display colors.
62
63never: Never display colors.
64
65           May also be specified with the term.color config value
66           <https://doc.rust-lang.org/cargo/reference/config.html>.
67
68   Common Options
69       +toolchain
70           If Cargo has been installed with rustup, and the first argument to
71           cargo begins with +, it will be interpreted as a rustup toolchain
72           name (such as +stable or +nightly). See the rustup documentation
73           <https://rust-lang.github.io/rustup/overrides.html> for more
74           information about how toolchain overrides work.
75
76       --config KEY=VALUE or PATH
77           Overrides a Cargo configuration value. The argument should be in
78           TOML syntax of KEY=VALUE, or provided as a path to an extra
79           configuration file. This flag may be specified multiple times. See
80           the command-line overrides section
81           <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
82           for more information.
83
84       -C PATH
85           Changes the current working directory before executing any
86           specified operations. This affects things like where cargo looks by
87           default for the project manifest (Cargo.toml), as well as the
88           directories searched for discovering .cargo/config.toml, for
89           example. This option must appear before the command name, for
90           example cargo -C path/to/my-project build.
91
92           This option is only available on the nightly channel
93           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
94           requires the -Z unstable-options flag to enable (see #10098
95           <https://github.com/rust-lang/cargo/issues/10098>).
96
97       -h, --help
98           Prints help information.
99
100       -Z flag
101           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
102           details.
103

ENVIRONMENT

105       See the reference
106       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
107       for details on environment variables that Cargo reads.
108

EXIT STATUS

1100: Cargo succeeded.
111
112101: Cargo failed to complete.
113

EXAMPLES

115        1. Save the token for the default registry:
116
117               cargo login
118
119        2. Save the token for a specific registry:
120
121               cargo login --registry my-registry
122

SEE ALSO

124       cargo(1), cargo-logout(1), cargo-publish(1)
125
126
127
128                                                                CARGO-LOGIN(1)
Impressum