cargo设置国内源

  1. cargo的依赖库的默认源用的是https://crates.io/,但国内很多网络访问很慢
  2. 像python的pip和php的composer以及go都有国内的代理或镜像
  3. rust国内也有镜像源,中国科大的
  4. 设置cargo的国内镜像源
    • 在~/.cargo/目录下,建一个config文件,windows下注意不要有扩展名
    • 设置内容
[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"
# 如果所处的环境中不允许使用 git 协议,可以把上面的地址改为
# registry = "https://mirrors.ustc.edu.cn/crates.io-index"
#[http]
#check-revoke = false
posted @ 2020-12-21 14:11  千年寒冰火  阅读(7149)  评论(0编辑  收藏  举报