# Install libgit2 with Homebrew, apk, apt, dnf, MacPorts, Nix, pacman, zypper

C library of Git core methods that is re-entrant and linkable. Version 1.9.4 via Homebrew; verified 2026-05-22.

## Install

```sh
sudo av install brew:libgit2
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install libgit2
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install libgit2
```

  Evidence: MacPorts ports tree: devel/libgit2/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add libgit2
```

  Evidence: Alpine Linux edge package indexes: libgit2 from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install libgit2-1.9
```

  Evidence: Debian stable package indexes: libgit2-1.9 from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install libgit2
```

  Evidence: Fedora Rawhide package metadata: libgit2 from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#libgit2
```

  Evidence: nixpkgs package indexes: pkgs/by-name/li/libgit2/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S libgit2
```

  Evidence: Arch Linux sync databases: libgit2 from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- Ubuntu apt (92%):

```sh
sudo apt install libgit2-1.7
```

  Evidence: Ubuntu 24.04 LTS package indexes: libgit2-1.7 from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz

- zypper (92%):

```sh
sudo zypper install libgit2-1_9
```

  Evidence: openSUSE Tumbleweed package metadata: libgit2-1_9 from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst

## Package facts

- **Package key:** brew:libgit2
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/libgit2>
- **Version:** 1.9.4
- **Source summary:** C library of Git core methods that is re-entrant and linkable
- **Homepage:** <https://libgit2.org/>
- **Repository:** <https://github.com/libgit2/libgit2>
- **Upstream docs:** <https://libgit2.org/docs>
- **License:** GPL-2.0-only WITH GCC-exception-2.0
- **Source archive:** <https://github.com/libgit2/libgit2/archive/refs/tags/v1.9.4.tar.gz>
- **Last updated:** 2026-05-22T13:50:55Z
- **Generated:** 2026-07-09T07:20:21+00:00

## Executables

- git2 (cli)
- git2 (alias)

## Dependencies

- libssh2
- llhttp

## Build dependencies

- cmake
- pkgconf

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## Freshness

- Page generated: 2026-07-09
- Package-manager version: 1.9.4
- Package-manager updated: 2026-05-22
- Local data: ok
- Upstream repository: https://github.com/libgit2/libgit2
- Upstream latest detected: v1.9.4 (current)
## Project history and usage

libgit2 is a portable C implementation of Git core methods as a re-entrant, linkable library. It became important because the original Git executable was not designed as an embeddable library, while editors, forges, desktop clients, hosting providers, and language bindings needed Git behavior inside long-running applications.

### Project history

GitHub's 2010 project announcement describes libgit2 as started by Shawn Pearce a few years earlier, then revived through a Google Summer of Code project by Vicent Marti with Scott Chacon as mentor. The immediate motivation was practical: Git's own code called die() and was not re-entrant, so GUI, web, and scripting users often had to fork and parse the Git binary.

The upstream README describes libgit2 as a portable pure-C implementation with a solid API, usable from C directly and through bindings. By 2020, maintainer Edward Thomson announced libgit2 1.0 after many years of planning and bug fixing; by late 2024 maintainers were publicly discussing planned ABI/API changes for libgit2 2.0 and SHA-256 support.

### Adoption history

libgit2's adoption followed the rise of Git as a developer platform rather than only a command-line tool. The upstream README says it is used by GUI clients, hosting providers, forges, utilities, and applications, with bindings for Ruby, .NET, Python, Node.js, Rust, and more.

Because it is a shared C library with many language bindings, package managers ship libgit2 as infrastructure for other packages. Its releases matter to downstreams when Git compatibility, transport security, SHA-1/SHA-256 behavior, or ABI stability changes.

### How it is used

Applications use libgit2 to open repositories, inspect objects and references, read and write commits, perform network operations, and embed Git workflows without shelling out to the Git CLI.

The library is especially attractive for IDEs, Git GUI clients, web services, and language ecosystems that want native bindings. The included git2 executable is secondary; the main value is the API surface.

### Why package nerds care

libgit2 is one of the canonical examples of turning a famous CLI tool's behavior into a stable embeddable library. For package nerds, the interesting part is not just Git support; it is ABI management, language binding compatibility, bundled-versus-system crypto and SSH choices, and the long path to a 1.0 library release.

It also explains why some packages depend on libgit2 even when Git itself is installed: they need in-process repository operations and predictable APIs, not subprocess output.

### Timeline

- 2008: Shawn Pearce had started libgit2 by the period described in GitHub's 2010 announcement.
- 2010: GitHub announced renewed libgit2 work after a Google Summer of Code effort by Vicent Marti.
- 2020: libgit2 0.99 was released on 19 February 2020 as the project approached 1.0.
- 2020: libgit2 1.0 was announced on 1 April 2020.
- 2024: Maintainers stated that libgit2 v1.9 was expected to be the final v1.x release line.
- 2025: libgit2 v1.9.2 release notes documented security fixes for external SSH execution and SSH credential creation.

### Related projects

- Git is the reference command-line system whose repository behavior libgit2 implements as a library. Rugged, pygit2, NodeGit, git2-rs, and .NET bindings are language-level entry points. GitHub, GitLab, Bitbucket-style forges, IDEs, and desktop Git clients are common application categories cited by project material.

### Sources

- <https://formulae.brew.sh/formula/libgit2>
- <https://github.blog/news-insights/libgit2-a-git-linkable-library/>
- <https://github.com/libgit2/libgit2>
- <https://github.com/libgit2/libgit2/discussions/6988>
- <https://github.com/libgit2/libgit2/releases>
- <https://libgit2.org/>
- <https://libgit2.org/docs>
- <https://www.edwardthomson.com/blog>


## Security Notes

library-like package without higher-risk signals.

- **Geiger risk:** green / low
- library-like package without higher-risk signals

## Source Database Details

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** libgit2
- **Aliases:** libgit2@1.9
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

## Other Package-Manager Records

- Debian apt - libgit2-1.9 - 1.9.0+ds-2: normalized package name match | Debian stable package indexes: libgit2-1.9 from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | low-level Git library | https://libgit2.github.com/
- Debian apt - libgit2-dev - 1.9.0+ds-2: normalized package name match | Debian stable package indexes: libgit2-dev from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | low-level Git library (development files) | https://libgit2.github.com/
- Debian apt - libgit2-fixtures - 1.9.0+ds-2: normalized package name match | Debian stable package indexes: libgit2-fixtures from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | low-level Git library - test suite examples | https://libgit2.github.com/
- Nix - libgit2: normalized package name match | nixpkgs package indexes: pkgs/by-name/li/libgit2/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - libgit2-1.7 - 1.7.2+ds-1ubuntu3: normalized package name match | Ubuntu 24.04 LTS package indexes: libgit2-1.7 from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | low-level Git library | https://libgit2.github.com/
- Ubuntu apt - libgit2-dev - 1.7.2+ds-1ubuntu3: normalized package name match | Ubuntu 24.04 LTS package indexes: libgit2-dev from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | low-level Git library (development files) | https://libgit2.github.com/
- Ubuntu apt - libgit2-fixtures - 1.7.2+ds-1ubuntu3: normalized package name match | Ubuntu 24.04 LTS package indexes: libgit2-fixtures from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | low-level Git library - test suite examples | https://libgit2.github.com/
- apk - libgit2 - 1.9.4-r1: normalized package name match | Alpine Linux edge package indexes: libgit2 from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | linkable library for Git | https://libgit2.org/
- apk - libgit2-dbg - 1.9.4-r1: normalized package name match | Alpine Linux edge package indexes: libgit2-dbg from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | linkable library for Git (debug symbols) | https://libgit2.org/
- apk - libgit2-dev - 1.9.4-r1: normalized package name match | Alpine Linux edge package indexes: libgit2-dev from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | linkable library for Git (development files) | https://libgit2.org/
- apk - libgit2-static - 1.9.4-r1: normalized package name match | Alpine Linux edge package indexes: libgit2-static from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | linkable library for Git (static library) | https://libgit2.org/
- apk - libgit2-tests - 1.9.4-r1: normalized package name match | Alpine Linux edge package indexes: libgit2-tests from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | linkable library for Git (tests) | https://libgit2.org/
- apk - libgit2-tools - 1.9.4-r1: normalized package name match | Alpine Linux edge package indexes: libgit2-tools from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | linkable library for Git (tools) | https://libgit2.org/
- dnf - libgit2 - 1.9.4-1.fc45: normalized package name match | Fedora Rawhide package metadata: libgit2 from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | C implementation of the Git core methods as a library with a solid API | https://libgit2.org/
- dnf - libgit2-devel - 1.9.4-1.fc45: normalized package name match | Fedora Rawhide package metadata: libgit2-devel from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Development files for libgit2 | https://libgit2.org/
- pacman - libgit2 - 1:1.9.4-1: normalized package name match | Arch Linux sync databases: libgit2 from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | A linkable library for Git | https://github.com/libgit2/libgit2


## Related links

- [Source-control packages](https://www.automicvault.com/pkg/source-control-tools/) - Belongs to a source-control command family.
- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://www.automicvault.com/pkg/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [cmake](https://www.automicvault.com/pkg/brew/cmake/) - Build dependency declared by Homebrew.
- [pkgconf](https://www.automicvault.com/pkg/brew/pkgconf/) - Build dependency declared by Homebrew.
- [bat](https://www.automicvault.com/pkg/brew/bat/) - Popular package that depends on this formula.
- [cargo-c](https://www.automicvault.com/pkg/brew/cargo-c/) - Popular package that depends on this formula.
- [cargo-generate](https://www.automicvault.com/pkg/brew/cargo-generate/) - Popular package that depends on this formula.
- [cargo-outdated](https://www.automicvault.com/pkg/brew/cargo-outdated/) - Popular package that depends on this formula.
- [cargo-release](https://www.automicvault.com/pkg/brew/cargo-release/) - Popular package that depends on this formula.
- [cargo-udeps](https://www.automicvault.com/pkg/brew/cargo-udeps/) - Popular package that depends on this formula.
- [cargo-update](https://www.automicvault.com/pkg/brew/cargo-update/) - Popular package that depends on this formula.
- [cocogitto](https://www.automicvault.com/pkg/brew/cocogitto/) - Popular package that depends on this formula.
- [braid](https://www.automicvault.com/pkg/brew/braid/) - Shares av.db curated category or tags: cli, developer-tools, git, version-control.
- [codeberg-cli](https://www.automicvault.com/pkg/brew/codeberg-cli/) - Shares av.db curated category or tags: cli, developer-tools, git, version-control.
- [dura](https://www.automicvault.com/pkg/brew/dura/) - Shares av.db curated category or tags: cli, developer-tools, git, version-control.
- [gcli](https://www.automicvault.com/pkg/brew/gcli/) - Shares av.db curated category or tags: cli, developer-tools, git, version-control.
- [git-branchless](https://www.automicvault.com/pkg/brew/git-branchless/) - Shares av.db curated category or tags: cli, developer-tools, git, version-control.
- [git-cinnabar](https://www.automicvault.com/pkg/brew/git-cinnabar/) - Shares av.db curated category or tags: cli, developer-tools, git, version-control.
- [git-cola](https://www.automicvault.com/pkg/brew/git-cola/) - Shares av.db curated category or tags: cli, developer-tools, git, version-control.
- [git-gui](https://www.automicvault.com/pkg/brew/git-gui/) - Shares av.db curated category or tags: cli, developer-tools, git, version-control.
- [git-series](https://www.automicvault.com/pkg/brew/git-series/) - Local package facts share a topical domain. Shared terms: cli, control, developer, developer-tools, git.
- [git-workspace](https://www.automicvault.com/pkg/brew/git-workspace/) - Local package facts share a topical domain. Shared terms: cli, control, developer, developer-tools, git.
- [git-ftp](https://www.automicvault.com/pkg/brew/git-ftp/) - Local package facts share a topical domain. Shared terms: cli, control, developer, developer-tools, git.

## Combined YAML source

View the package source record on GitHub. [combined/libgit2.yml](https://github.com/automic-vault/db/blob/main/combined/libgit2.yml)


## Sources

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
