nodegit /nodegit

Native Node bindings to Git.

★ 5,753⑂ 709👁 66⑃ 936● 1,103▤ 87
JavaScriptMITCreated 2011-02-18www.nodegit.org/
下载:v0.27.0 (2020-07-28)v0.27.0 ↓0.27.02020-07-28
+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

Latest release

v0.27.0 (2020-07-28) v0.27.0 2020-07-28
Summary 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

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON