default = "gitea"
[registries.gitea]
-index = "https://gitea.example.com/{owner}/_cargo-index.git"
+index = "sparse+https://gitea.example.com/api/packages/{owner}/cargo/" # Sparse index
+# index = "https://gitea.example.com/{owner}/_cargo-index.git" # Git
-[net]
-git-fetch-with-cli = true
+# [net]
+# git-fetch-with-cli = true
```
| Parameter | Description |
| --------- | ----------- |
| `token` | Your [personal access token](development/api-usage.md#authentication) |
+## Git vs Sparse
+
+Currently, cargo supports two ways for fetching crates in a registry: Git index & sparse index.
+Sparse index is the newest method and offers better performance when updating crates compared to git.
+Since Rust 1.68, sparse is the default method for crates.io.
+
## Publish a package
Publish a package by running the following command in your project:
default = "gitea"
[registries.gitea]
-index = "https://gitea.example.com/{owner}/_cargo-index.git"
+index = "sparse+https://gitea.example.com/api/packages/{owner}/cargo/" # Sparse index
+# index = "https://gitea.example.com/{owner}/_cargo-index.git" # Git
[net]
git-fetch-with-cli = true
default = "gitea"
[registries.gitea]
-index = "<gitea-origin-url data-url="{{AppSubUrl}}/{{.PackageDescriptor.Owner.Name}}/_cargo-index.git"></gitea-origin-url>"
+index = "<gitea-origin-url data-url="sparse+{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/cargo/"></gitea-origin-url>" # Sparse index
+# index = "<gitea-origin-url data-url="{{AppSubUrl}}/{{.PackageDescriptor.Owner.Name}}/_cargo-index.git"></gitea-origin-url>" # Git
[net]
git-fetch-with-cli = true</code></pre></div>