Index Cargo Repositories Using Git Indexing

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

Note

From Artifactory version 7.58.x, the default method for Cargo indexing is sparse indexing. However, If you are using an Artifactory earlier than 7.46.3, or a Cargo client earlier than 1.60, you may need to use Cargo Git Indexing.

To configure the Cargo client to work opposite JFrog Artifactory using Git indexing:

  1. Edit the configuration file under your Cargo home directory (for example ~/.cargo/config.toml):

    # Makes artifactory the default registry and saves passing --registry parameter
    [registry]
    default = "artifactory"
     
     
    [registries.artifactory]
    index = "https://company.jfrog.io/artifactory/git/bank32-cargo-local-2.git"
     
    # For sending credentials in git requests.
    # Not required if anonymous access is enabled
    [net]
    git-fetch-with-cli = true
  2. To set your credentials for API calls such as publish and yank, add the following section to the credentials file under your Cargo home directory (for example ~/.cargo/credentials.toml):

    [registries.artifactory]
    token = "<identity_token>"

Git Support for Cargo Repositories

As the Cargo Client requires the Cargo registry to be a Git repository, the following Git support has been applied in Artifactory:

  • An internal .git folder exists for each Cargo repository to reflect the index .git files. This folder is recreated after every reindexing process.

  • An internal git directory in the Data directory of Artifactory has been added for each Cargo repository. This is a local clone that will be recreated following each restart or repository init.