+0
日增长
5,753
stars
709
forks
66
watchers
936
prs
1,103
issues
87
releases
README
NodeGit
Node bindings to the libgit2 project.
[!IMPORTANT]
NodeGit is no longer maintained.
No further releases, bug fixes, or security updates are planned,
and new issues and pull requests will not be reviewed.
Existing versions will remain installable from npm, and their prebuilt binaries
will stay available for the foreseeable future.
Alumni Maintainers
NodeGit was built and maintained by
Alex Aveillán @AlexaXs,
Ian Hattendorf @ianhattendorf,
John Alden @zawata,
Tyler Ang-Wanek @twwanek,
Tim Branyen @tbranyen,
John Haley @johnhaley81,
Max Korp @maxkorp,
Steve Smith @orderedlist,
Michael Robinson @codeofinterest, and
Nick Kallen @nk, with help from tons of
awesome contributors!
API Documentation.
http://www.nodegit.org/
Getting started.
NodeGit will work on most systems out-of-the-box without any native
dependencies.
bash
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:
sh
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install libstdc++-4.9-dev
In Travis:
yaml
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libstdc++-4.9-dev
In CircleCI:
yaml
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:
javascript
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.
return entry.getBlob().then(function(blob) {
blob.entry = entry;
return blob;
});
})
// Display information about the blob.
.then(function(blob) {
// Show the path, sha, and filesize in bytes.
console.log(blob.entry.path() + blob.entry.sha() + blob.rawsize() + "b");
Top issues
#1018Support gpg commit signing48 comments · 2016-04-30#1840Can't be installed for Node v1644 comments · 2021-04-29#1361Cannot be installed under Docker Alpine30 comments · 2017-08-30#1774Make nodegit context-aware for compatibility with Electron 9 and beyond27 comments · 2020-05-24#1850bintray returns 403 Forbidden when trying to download openssl26 comments · 2021-07-06#1347Installing nodegit via npm fails at Configuring libssh2.26 comments · 2017-08-07#1246npm install nodegit, gitkraken, CycligentGitTool all fail to install, run, on Linux Mint Cinnamon26 comments · 2017-03-07#1335Module not found: Error: Can't resolve '../build/Debug/nodegit.node'25 comments · 2017-07-27
Latest release
v0.27.0 (2020-07-28) v0.27.0 2020-07-28Summary of changes - Expose git_remote_rename - Bump OpenSSL from 1.1.0i - 1.1.1c in Windows/Mac OS Electron builds - Replace unmaintained request library with got - Remove promisify-node and use vanilla promises for all NodeGit promises - Prebuilds for Node 14, deprecate Node 8 - Persist RemoteCallbacks and ProxyOptions on the remote if using Remote.prototype.connect. This fixes a segfault when using any routines on a connected remote. Merged PRs into NodeGit - Upgrade build environments 1785 - Remote needs to persist the callback/proxyOpts/headers 1784 - Remove promisify-node an