NodeGit
Node bindings to the libgit2 project.
Stable (libgit2@v0.28.3): 0.28.3
Have a problem? Come chat with us!
Visit slack.libgit2.org to sign up, then join us in #nodegit.
Maintained by
Tyler Ang-Wanek @twwanek with help from tons of awesome contributors!
Alumni Maintainers
Tim Branyen @tbranyen, John Haley @johnhaley81, Max Korp @maxkorp, Steve Smith @orderedlist, Michael Robinson @codeofinterest, and Nick Kallen @nk
API Documentation.
Getting started.
NodeGit will work on most systems out-of-the-box without any native dependencies.
npm install nodegit
If you receive errors about libstdc++, which are commonly experienced when building on Travis-CI, you can fix this by upgrading to the latest libstdc++-4.9.
In Ubuntu:
sudo add-apt-repository ppa:ubuntu-toolchain-r/testsudo apt-get updatesudo apt-get install libstdc++-4.9-dev
In Travis:
addons:apt:sources:- ubuntu-toolchain-r-testpackages:- libstdc++-4.9-dev
In CircleCI:
dependencies:pre:- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test- sudo apt-get update- sudo apt-get install -y libstdc++-4.9-dev
If you receive errors about lifecycleScripts preinstall/install you probably miss libssl-dev In Ubuntu:
sudo apt-get install libssl-dev
You will need the following libraries installed on your linux machine:
- libpcre
- libpcreposix
- libkrb5
- libk5crypto
- libcom_err
When building locally, you will also need development packages for kerberos and pcre, so both of these utilities must be present on your machine:
- pcre-config
- krb5-config
If you are still encountering problems while installing, you should try the Building from source instructions.
API examples.
Cloning a repository and reading a file:
var Git = ;// Clone a given repository into the `./tmp` folder.Git// Look up this known commit.// Look up a specific file within that commit.// Get the blob contents from the file.// Display information about the blob.;
Emulating git log:
var Git = ;// Open the repository directory.GitRepository// Open the master branch.// Display information about commits on master.;
For more examples, check the examples/
folder.
Unit tests.
You will need to build locally before running the tests. See above.
npm test