Registry / utility / git2
library0.21.0rscratesunverified

Bindings to libgit2 for interoperating with git repositories, both threadsafe and memory safe.

# Cargo.toml [dependencies] git2 = "0.21.0"
INSTALL
IMPORT
SIG · GIT2
G
git2
utilityrustv0.21.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Repository
use git2::Repository;

Open the current directory as a git repository and print its path.

use git2::Repository; fn main() -> Result<(), Box<dyn std::error::Error>> { let repo = Repository::open(".")?; println!("Repository path: {}", repo.path().display()); Ok(()) }
Debug
Known issues
gotchaRequires libgit2 system library; may need `pkg-config` or `cmake` to build.
fix
Install libgit2-dev (Linux) or use vendored feature: `git2 = { version = "0.21", features = ["vendored"] }`.
affects: >=0.21.0
Upgrade
Version history
0.21.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
git2 — cargo add git2 · libregistry