#sys #native

sys libgit2-sys

Native bindings to the libgit2 library

89 releases

0.7.7 Jul 30, 2018
0.7.3 May 31, 2018
0.7.1 Mar 7, 2018
0.6.18 Dec 20, 2017
0.0.1 Nov 13, 2014

#1 in Rendering engine

Download history 10980/week @ 2018-05-10 15410/week @ 2018-05-17 12390/week @ 2018-05-24 12610/week @ 2018-05-31 11881/week @ 2018-06-07 10148/week @ 2018-06-14 10242/week @ 2018-06-21 12084/week @ 2018-06-28 13851/week @ 2018-07-05 12840/week @ 2018-07-12 13651/week @ 2018-07-19 13781/week @ 2018-07-26 13797/week @ 2018-08-02

54,553 downloads per month
Used in 146 crates (2 directly)


95K SLoC

C 92K SLoC // 0.1% comments Rust 3K SLoC // 0.0% comments Shell 254 SLoC // 0.1% comments


Build Status Build Status


libgit2 bindings for Rust

git2 = "0.7"

Version of libgit2

Currently this library requires libgit2 0.25.1. The source for libgit2 is included in the libgit2-sys crate so there's no need to pre-install the libgit2 library, the libgit2-sys crate will figure that and/or build that for you.

Building git2-rs

First, you'll need to install CMake. Afterwards, just run:

$ git clone https://github.com/alexcrichton/git2-rs
$ cd git2-rs
$ cargo build

Automating Testing

Running tests and handling all of the associated edge cases on every commit proves tedious very quickly. To automate tests and handle proper stashing and unstashing of unstaged changes and thus avoid nasty surprises, use the pre-commit hook found here and place it into the .git/hooks/ with the name pre-commit. You may need to add execution permissions with chmod +x.

To skip tests on a simple commit or doc-fixes, use git commit --no-verify.

Building on OSX 10.10+

Currently libssh2 requires linking against OpenSSL, and to compile libssh2 it also needs to find the OpenSSL headers. On OSX 10.10+ the OpenSSL headers have been removed, but if you're using Homebrew you can install them via:

brew install openssl


This project is licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in git2-rs by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~82K SLoC