Cargo repositories use the sparse index (Cargo 1.70 and newer).
The examples use the conventional names cargo-hosted and cargo-proxy.
Connecting
Describe the registry in ~/.cargo/config.toml;
for repositories that require authentication,
list the credential provider explicitly:
[registry]
global-credential-providers = ["cargo:token"]
[registries.galleon]
index = "sparse+https://<GALLEON_HOST>/repository/cargo-hosted/"The token is a ready Basic <BASE64> string; store it with cargo login:
printf 'Basic <BASE64>\n' | cargo login --registry galleonProxy for crates.io
To route all public dependencies through Galleon, configure source replacement —
the registry is also declared under [registries] so a token can be attached to it:
[registries.galleon-proxy]
index = "sparse+https://<GALLEON_HOST>/repository/cargo-proxy/"
[source.crates-io]
replace-with = "galleon-proxy"
[source.galleon-proxy]
registry = "sparse+https://<GALLEON_HOST>/repository/cargo-proxy/"If the proxy repository requires authentication,
store a token for it as well: cargo login --registry galleon-proxy
(the same Basic <BASE64> string).
Usage
A dependency from the hosted registry is declared in Cargo.toml with the registry name:
mycrate = { version = "1", registry = "galleon" }Publishing
A crate is sent to the hosted registry under the name declared in registries.galleon:
cargo publish --registry galleonSpecifics
Format specifics:
- Re-publishing an existing version is rejected with
409; names are compared case-insensitively, with-and_treated as the same character. cargo yankis supported: the version is flagged in the index, but the file is not deleted — builds with the exact version inCargo.lockkeep working. Theeditprivilege is required.cargo searchandcargo ownerare not supported.