Skip to main content

git

6 configuration options · available in Rust, Go

Quick start
use opendal::Operator;

let operator = Operator::via_iter("git", [
("repository".to_string(), "https://huggingface.co/hf-internal-testing/tiny-random-bert".to_string()),
])?;
All configuration options (copy & trim)
Full reference
use opendal::Operator;

let operator = Operator::via_iter("git", [
// Git repository URL or local path.
//
// Examples:
//
// - `https://github.com/apache/opendal.git`
// - `https://huggingface.co/hf-internal-testing/tiny-random-bert`
// - `file:///path/to/repository.git`
//
// This is required.
("repository".to_string(), "https://huggingface.co/hf-internal-testing/tiny-random-bert".to_string()),

// Git reference to resolve.
//
// The value can be a branch, tag, commit hash, or `HEAD`. The reference is
// resolved once when the operator first accesses the repository. Later
// operations use the same immutable snapshot and do not refresh it.
//
// The default is `HEAD`.
// ("reference".to_string(), "HEAD".to_string()),

// Root path within the repository.
//
// All operations are relative to this path. The default is `/`.
// ("root".to_string(), "/".to_string()),

// Username used for the Git fetch and same-origin LFS requests.
//
// Credentials are not sent to a cross-origin LFS download action. This is
// optional.
// ("username".to_string(), "...".to_string()),

// Password or personal access token used for the Git fetch and
// same-origin LFS requests.
//
// Credentials are not sent to a cross-origin LFS download action. This is
// optional.
// ("password".to_string(), "...".to_string()),

// Whether to resolve Git LFS pointer files.
//
// When enabled, the service detects Git LFS pointers and streams the
// referenced object. When disabled, the pointer file itself is returned.
// The default is `true`.
// ("resolve_lfs".to_string(), "true".to_string()),
])?;

Every option is passed as a string key; OpenDAL parses it into the right type. Some services may require building the binding with the matching services-* feature enabled.

Configuration reference

General6
KeyTypeRequiredDescription
repositorye.g. https://huggingface.co/hf-internal-testing/tiny-random-bertstringyesGit repository URL or local path. Examples: - https://github.com/apache/opendal.git - https://huggingface.co/hf-internal-testing/tiny-random-bert - file:///path/to/repository.git This is required.
referencedefault HEADstringnoGit reference to resolve. The value can be a branch, tag, commit hash, or HEAD. The reference is resolved once when the operator first accesses the repository. Later operations use the same immutable snapshot and do not refresh it. The default is HEAD.
rootdefault /stringnoRoot path within the repository. All operations are relative to this path. The default is /.
usernamestringnoUsername used for the Git fetch and same-origin LFS requests. Credentials are not sent to a cross-origin LFS download action. This is optional.
passwordstringnoPassword or personal access token used for the Git fetch and same-origin LFS requests. Credentials are not sent to a cross-origin LFS download action. This is optional.
resolve_lfsdefault trueboolnoWhether to resolve Git LFS pointer files. When enabled, the service detects Git LFS pointers and streams the referenced object. When disabled, the pointer file itself is returned. The default is true.