Cargo Package Registry
To work with the Cargo registry, you need to obtain a GitFlic transport token. For instructions on obtaining a token, see this page.
In the documentation below, replace {gitflic_domain} with:
- For SaaS version:
registry.gitflic.ru - For Self-hosted:
localhost:8080
Domain and port may differ for self-hosted installations.
Cargo Registry Configuration
To use the Cargo registry, create/edit the configuration file ~/.cargo/config.toml and add:
[registry]
global-credential-providers = ["cargo:token"]
[registries.gitflic]
index = "sparse+http://localhost:8045/project/adminuser/rust/package/-/cargo/"
| Level | URL |
|---|---|
| Project | sparse+http(s)://{gitflic_domain}/project/{ownerAlias}/{projectAlias}/package/-/cargo |
| Company | sparse+http(s)://{gitflic_domain}/company/{companyAlias}/package/-/cargo |
| Instance | sparse+http(s)://{gitflic_domain}/registry/package/-/cargo |
| URL Variable | Description |
|---|---|
ownerAlias |
Project owner alias |
projectAlias |
Project alias |
companyAlias |
Company alias |
To set GitFlic as the default registry (avoiding the --registry flag), add to ~/.cargo/config.toml:
[registry]
default = "gitflic"
For publishing packages or using private repositories, run:
cargo login --registry gitflic
Use your transport token for authentication.
Working with the Registry
Adding and Installing Packages
To add a dependency to your project:
cargo add {packageName} --registry gitflic
Or specify a version:
cargo add {packageName}@{packageVersion} --registry gitflic
To download packages:
cargo fetch
cargo build
Publishing and Removing Packages
To publish the current package state to GitFlic registry:
cargo publish --registry gitflic
To remove a specific package version:
cargo yank {packageName}@{packageVersion} --registry gitflic
To restore a package to the index:
cargo yank {packageName}@{packageVersion} --undo --registry gitflic
For your information
Yank means that this version ** cannot be pulled up automatically when adding a new dependency without specifying the version**. But if in Cargo.toml explicitly specify this version, cargo will install it anyway.
Package Search
Cargo has built-in search functionality. To search for packages:
cargo search {packageName} --registry gitflic