Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publishing with a crates.io mirror has a confusing error message #6722

Closed
ehuss opened this issue Mar 7, 2019 · 3 comments
Closed

Publishing with a crates.io mirror has a confusing error message #6722

ehuss opened this issue Mar 7, 2019 · 3 comments
Labels
A-registries Area: registries C-bug Category: bug Command-publish

Comments

@ehuss
Copy link
Contributor

ehuss commented Mar 7, 2019

Problem
If one is using a mirror of crates.io, the error message you get when you attempt to publish is confusing. It says:

error: crates cannot be published to crates.io with dependencies sourced from other
registries either publish `bitflags` on crates.io or pull it into this repository
and specify it with a path and version
(crate `bitflags` is pulled from registry `https://github.com/rust-lang/crates.io-index`)

The last line clearly says that it is from "crates.io".

Steps

  1. Check out crates.io index (https://github.com/rust-lang/crates.io-index)
  2. Create a project with a dependency from crates.io.
  3. Add a .cargo/config file to set up the mirror:
[source.crates-io]
replace-with="mirror"

[source.mirror]
registry = "file:///path/to/crates.io-index"
  1. cargo publish --dry-run

Possible Solution(s)

  • Display a better error message, possibly instructing the user to disable the mirror.
  • Detect that a mirror is being used, and allow it to proceed. This seems like it could be tricky.

Notes

  • cargo 1.34.0-nightly (5c6aa46 2019-02-22)
  • Reported by user "calidion" on Discord #crates-io
@ehuss ehuss added C-bug Category: bug Command-publish A-registries Area: registries labels Mar 7, 2019
@clearloop
Copy link

clearloop commented May 23, 2019

Same problem, annotated ~/.cargo/config temporarily.

# [source.crates-io]
# registry = "https://github.com/rust-lang/crates.io-index"
# replace-with = 'ustc'
# [source.ustc]
# registry = "git://mirrors.ustc.edu.cn/crates.io-index"

@kmod-midori
Copy link

Connection to GitHub is basically trash for some ISPs in China, so a mirror is sometimes required. Having to comment out ~/.cargo/config every time I need to publish a crate can be annoying.

@ehuss
Copy link
Contributor Author

ehuss commented Dec 7, 2022

Closing since I believe this is now fixed via #10907. The new error message is:

error: crates-io is replaced with non-remote-registry source registry `mirror`;
include `--registry crates-io` to use crates.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-registries Area: registries C-bug Category: bug Command-publish
Projects
None yet
Development

No branches or pull requests

3 participants