cargo publish Command

If you configured a registries entry in ~/.cargo/config.toml and saved your auth token with cargo login, you can publish by specifying the --registry flag:

$ cd ~/src/my-proprietary-crate
$ cargo publish --registry my-crate-registry

Alternatively, the auth token and also crate index url can be specified manually:

$ TOKEN="x8P1UUELcY6SxRA3Ylsjlkjsdfoiew0239Lh7Gth5qrI46a3mZ47cjA0wDU+9cNmJMQ="
$ INDEX=""

$ cargo publish \
--index ${INDEX} \
--token ${TOKEN}

As discussed in Case Study: cargo publish --help, there are multiple ways to specify registry and/or authentication token using the cargo publish command:

cargo publish --help
Upload a package to the registry

  cargo publish [OPTIONS]

      --index <INDEX>             Registry index URL to upload the package to
      --token <TOKEN>             Token to use when uploading
      --registry <REGISTRY>       Registry to publish to
      # ...