Rust构建提示Updating crates.io index错误

使用Cargo构建时提示如下错误:

Updating crates.io index
error: failed to fetch https://github.com/rust-lang/crates.io-index

这是由于网络原因导致的,可替换为清华源。

编辑Cargo Config文件:

vi $HOME/.cargo/config

写入以下代码:

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"

# 替换成清华镜像源
replace-with = 'tuna'

# 清华大学
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"

# rustcc社区
[source.rustcc]
registry = "git://crates.rustcc.cn/crates.io-index"

[net]
git-fetch-with-cli=true

原创文章,作者:,如若转载,请注明出处:https://ce.771633.xyz/2120.html

Like (0)
Previous 2025年3月8日
Next 2025年3月8日

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注