Can't Publish Crate Because of status 403 Forbidden

I want to publish my Rust project to crates.io, and all my information and login steps are fine, but when I run cargo publish, I get an error:

error: failed to publish to registry at https://crates.io
 
Caused by:
  the remote server responded with an error (status 403 Forbidden): this token does not have the required permissions to perform this action

Why? Can anyone help me?

  1. Go to https://crates.io/settings/tokens/new

  2. Check the “publish-new” checkbox (and any others you want).

  3. Click “Generate Token”.

  4. Run cargo login and paste the new token you got.

All my information and login steps were fine, I tried many times but still failed at last.

Is it possible that a crate of the same name[1] already exists on crates.io but is owned by someone else?


  1. Or a name that normalizes to the same thing, e.g., serde-json is equivalent to serde_json ↩︎

1 Like