crates.io Mirror Usage Guide
info
Some content in this document may have been translated by AI.
Cargo Usage Method
Add the following content to $CARGO_HOME/config.toml:
CARGO_HOME Default Path
- On Windows,
$CARGO_HOMEdefaults to:%USERPROFILE%\.cargo, for example C:\Users\test.cargo - On *nix systems,
$CARGO_HOMEdefaults to:$HOME/.cargo, for example /home/test/.cargo
Whether to use sparse index (cargo >= 1.68)
[source.crates-io]
replace-with = 'hustmirror'
[source.hustmirror]
registry = "sparse+https://mirrors.hust.edu.cn/crates.io-index/"
About Sparse Index
Starting from cargo version 1.68, sparse index is supported: no longer need to fully clone the crates.io-index repository, which can speed up package fetching.
If your cargo version is less than 1.68, you can use sparse index with cargo +nightly -Z sparse-registry update.