cargo login
with 2nd alternate registry overwrites 1st alternate registry's token in ~/.cargo/credentials
#7701
Labels
Problem
When working on crates.io, I often run an instance locally and interact with it through cargo. We also have a staging instance where I test things out. So this is 2 alternate registries in addition to the main crates.io.
My
~/.cargo/config
looks like this:If I run
cargo login --registry staging [token]
then runcargo login --registry local [other-token]
,~/.cargo/credentials
only contains the credentials for the local registry.Steps
Using rustc 1.39.0 (4560ea788 2019-11-04)/cargo 1.39.0 (1c6ec66 2019-09-30), create a
~/.cargo/config
containing 2 alternate registries as shown above.Move your existing
~/.cargo/credentials
file elsewhere if you don't want to mess it up reproducing this.Run
cargo login abcde
to set your token for the main crates.io registry.Observe that
~/.cargo/credentials
contains these contents, as expected:cargo login --registry staging fghij
.~/.cargo/credentials
contains these contents, as expected:cargo login --registry local klmno
.~/.cargo/credentials
contains these contents, withlocal
and the main registry present as expected, but withstaging
gone:The contents I expected to have would contain tokens for all 3 registries, like:
Possible Solution(s)
Unclear, I was going to go poking around after filing this.
Notes
Output of
cargo version
:cargo 1.39.0 (1c6ec66d5 2019-09-30)
, current stable on macOS.I was also able to reproduce with
rustc 1.41.0-nightly (27d6f55f4 2019-12-11)
/cargo 1.41.0-nightly (626f0f40e 2019-12-03)
.The text was updated successfully, but these errors were encountered: