Solve the problem that Cargo downloads too slowly

Original link: https://jasonkayzk.github.io/2022/08/14/%E8%A7%A3%E5%86%B3Cargo%E4%B8%8B%E8%BD%BD%E8%BF%87% E6%85%A2%E7%9A%84%E9%97%AE%E9%A2%98/

Change the source of cargo to speed up;

Solve the problem that Cargo downloads too slowly

Open the cargo directory, which is under ~/.cargo by default:

 cd ~/.cargo

Create the config file:

 vim config

Add the following code:

 # 放到`$HOME/.cargo/config` 文件中[source.crates-io]registry = "https://github.com/rust-lang/crates.io-index"# 替换成你偏好的镜像源replace-with = 'sjtu'#replace-with = 'ustc'# 清华大学[source.tuna]registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"# 中国科学技术大学[source.ustc]registry = "git://mirrors.ustc.edu.cn/crates.io-index"# 上海交通大学[source.sjtu]registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"# rustcc社区[source.rustcc]registry = "git://crates.rustcc.cn/crates.io-index"

Just save it!

This article is reproduced from: https://jasonkayzk.github.io/2022/08/14/%E8%A7%A3%E5%86%B3Cargo%E4%B8%8B%E8%BD%BD%E8%BF%87% E6%85%A2%E7%9A%84%E9%97%AE%E9%A2%98/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment