Description
When configuring Cargo using the "Set Me Up" instructions and subsequently running the cargo publish or cargo install command, users may encounter an error.
$ cargo publish --allow-dirty --registry artifactory
Updating `artifactory` index
error: authenticated registries require a credential-provider to be configured
Root Cause
The error occurs because the credential-provider is missing in the ~/.cargo/config.toml file.
Resolution
Set the credential-provider = "cargo:token" under the “token =” line in the ~/.cargo/config.toml file, such as:
[registry]
default = "artifactory"
[registries.artifactory]
index = "sparse+https://xx/artifactory/api/cargo/cargo-local/index/"
token = "Bearer xxxx"
credential-provider = "cargo:token"
Then run the cargo publish/install command again, it will succeed now.