qmetrics.net

Git2 Rs

Safe Rust bindings to the libgit2 Git library

Git2 Rs screenshot

git2-rs exposes libgit2 to Rust programs for repository work. Local repository features are enabled by default; optional features add HTTPS and SSH networking.

Overview

git2-rs provides Rust bindings to libgit2, the C library used to manage Git repositories. The crate wraps libgit2 closely while adding stronger types and automatic resource management, including Result-based error handling across interfaces.

By default the library supports local repository operations without network access. Enabling the https and/or ssh Cargo features unlocks cloning and other remote workflows; both are recommended when code accepts user-supplied repository URLs. The bundled libgit2-sys crate vendors libgit2 sources, so a system install is optional—static linking applies when vendoring is on or no suitable system library is found, and dynamic linking is attempted when an appropriate version is present.

Typical use starts from a Repository opened, initialized, or cloned on disk. Most derived objects—commits, branches, diffs, and similar types—tie to that repository’s lifetime so handles cannot outlive the parent repo. The API covers indexing, merging, rebasing, diffs, configuration, remotes, and many other libgit2 capabilities exposed as Rust modules and structs.

git2-rs targets stable Rust and generally supports the prior stable release as well. It requires libgit2 2.0.0-rc.1 or newer patch releases. When the ssh feature is enabled on macOS, builds depend on libssh2 and OpenSSL per upstream crate guidance.

Key features

  • Repository open init and clone
  • Optional HTTPS remote support
  • Optional SSH remote support
  • Vendored or dynamic libgit2
  • Strongly typed libgit2 APIs
  • Automatic resource cleanup
  • Merge rebase and diff APIs
  • Stable Rust compatibility

Use cases

  • Git automation in Rust
  • Custom repository tooling
  • Embedded Git operations
  • CI and build scripts
  • Remote clone with SSH or HTTPS

Similar software

Lazygit

Terminal user interface for everyday Git workflows

Lazygit wraps common Git operations in a keyboard-driven terminal UI. You can stage partial changes, rebase, cherry-pick, and inspect history without memorizing fragile command sequences.

★ 84.1k⟳ 5 days agoMIT

Gitea

Self-hosted Git forge with CI/CD and packages

Gitea is an all-in-one software development service you can run on your own infrastructure. It combines Git hosting with issues, reviews, project boards, package registries, and Gitea Actions CI/CD.

★ 59.3k⟳ todayMIT
Build & DeploymentSelf-hostable
Open Source Alternative to:GitHub

Gogs

Self-hosted Git service with web collaboration tools

Gogs hosts Git repositories over SSH and HTTP(S) and adds issues, pull requests, wikis, and organization features through a browser UI.

★ 48k⟳ 2 days agoMIT

GitHub CLI

Official GitHub terminal client

GitHub CLI brings issues, pull requests, and other GitHub workflows to the terminal beside git. It works with GitHub.com, Enterprise Cloud, and supported Enterprise Server deployments.

★ 47.3k⟳ yesterdayMIT

Harness

End-to-end developer platform with SCM, CI/CD, and registries

Harness Open Source combines code hosting, automated DevOps pipelines, hosted development environments called Gitspaces, and artifact registries in one platform.

★ 39k⟳ yesterdayApache-2.0
Build & DeploymentSelf-hostable
Open Source Alternative to:GitHub

Husky

Lightweight native Git hooks for Node projects

Husky wires Git hooks so teams can lint commit messages, run tests, or check code on commit and push. It uses core.hooksPath, stays around two kilobytes gzipped, and supports macOS, Linux, and Windows.

★ 35.4k⟳ 8 months agoMIT