package
Node.js libgit2 asynchronous native bindings
npm install nodegitGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Latest published Jul 28, 2020
next
johnhaley81
johnhaley81@gmail.com
Node bindings to the libgit2 project.
Stable (libgit2@v0.28.3): 0.28.3
Visit slack.libgit2.org to sign up, then join us in #nodegit.
Tyler Ang-Wanek @twwanek with help from tons of awesome contributors!
Tim Branyen @tbranyen, John Haley @johnhaley81, Max Korp @maxkorp, Steve Smith @orderedlist, Michael Robinson @codeofinterest, and Nick Kallen
NodeGit will work on most systems out-of-the-box without any native dependencies.
npm install nodegitIf 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/test
sudo apt-get update
sudo apt-get install libstdc++-4.9-devIn Travis:
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libstdc++-4.9-devIn 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-devIf you receive errors about lifecycleScripts preinstall/install you probably miss libssl-dev In Ubuntu:
sudo apt-get install libssl-devYou will need the following libraries installed on your linux machine:
When building locally, you will also need development packages for kerberos and pcre, so both of these utilities must be present on your machine:
If you are still encountering problems while installing, you should try the Building from source instructions.
var Git = require("nodegit");
// Clone a given repository into the `./tmp` folder.
Git.Clone("https://github.com/nodegit/nodegit", "./tmp")
// Look up this known commit.
.then(function(repo) {
// Use a known commit sha from this repository.
return repo.getCommit("59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5");
})
// Look up a specific file within that commit.
.then(function(commit) {
return commit.getEntry("README.md");
})
// Get the blob contents from the file.
.then(function(entry) {
// Patch the blob to contain a reference to the entry.
var Git = require("nodegit");
// Open the repository directory.
Git.Repository.open("tmp")
// Open the master branch.
.then(function(repo) {
return repo.getMasterCommit();
})
// Display information about commits on master.
.then(function(firstCommitOnMaster) {
// Create a new history event emitter.
var history = firstCommitOnMaster.history();
// Create a counter to only show up to 9 entries.
var count = 0;
// Listen for commit events from the history.
history.on("commit",
For more examples, check the examples/ folder.
You will need to build locally before running the tests. See above.
npm testEstimated unpacked size across 63 packages.
37.6 MB+
Includes dependencies.
13.1.0
^0.13.0
0.17.0