# crates.io-index **Repository Path**: crates/crates.io-index ## Basic Information - **Project Name**: crates.io-index - **Description**: https://crates.io 的国内镜像 https://crates.cn - **Primary Language**: Rust - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 9 - **Forks**: 0 - **Created**: 2019-07-14 - **Last Updated**: 2022-02-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # crates.io-index #### 介绍 https://github.com/rust-lang/crates.io-index.git 的国内镜像 # 一、镜像 https://crates.cn [https://crates.io](https://crates.io/) 的访问非常缓慢,github 的仓库也经常不能访问,建议大家切换到国内镜像站。镜像站实时缓存,托管在码云的 gitee 仓库每隔30分钟与 github 同步。 # 二、使用方式 在 .cargo 目录新建文件config 编辑文件内容: ``` [source.crates-io] registry="https://github.com/rust-lang/crates.io-index" // 这行可以不要,只是说明原始地址 replace-with='crates-cn' [source.crates-cn] registry="https://gitee.com/crates/crates.io-index.git" ``` 如果使用中科大USTC的镜像 ``` [source.crates-io] replace-with='ustc' [source.ustc] registry="https://mirrors.ustc.edu.cn/crates.io-index" ``` 修改完保存后执行build即可 ``` cargo build ``` # 三、关于 config 文件 > 注意:新安装的机器没有这个文件,需要新建,并且该文件没有后缀名 Linux 和 Mac,文件的位置为 ``` $HOME/.cargo/config ``` 例如 root 用户位置为 ``` # vim /root/.cargo/config ``` Windows用户的位置为 ``` C:\Users\${your-username}\.cargo\config ```