Using nodegit



Has anyone used nodegit in a package and made it work?

I’m trying to replace the means of accessing git history from the git-time-machine package. The currently published version of git-time-machine uses shell to git + stdout scrape and parse method used by several other Atom git packages when I started it.

I wrote a little npm package called libgit2-log-utils that simplifies nodegit’s async hell. When I try to add the libgit2-log-utils package to git-time-machine’s dependencies and reload atom, it gives me an error in the console like this:

“Failed to require the main module of ‘git-time-machine’ because it requires an incompatible native module.
Run apm rebuild in the package directory to resolve.”

I’ve run apm rebuild as suggested without remedy.

Of course it might also be the libgit2-log-utils dependency on es6-promise

Deprecation of Async Git in Atom 1.10

Update: it’s definitely nodegit. Just adding nodegit to git-time-machine package.json dependencies makes “incompatible native module” error happen.


I think atom include a copy of nodegit, since the effort to do git treeview stuff async.

More specifically

And this


I’m seeing the same thing with ‘ohnogit’, when I try to add it to my package dependencies, Atom burps the same “incompatible native module” error.

Either way it looks like ohnogit is a subset of methods from git-utils and neither of them expose the history functions :confused:


I think he’s trying to say that you don’t need to include nodegit or a wrapper module in your dependencies. I’m currently working on package that uses nodegit and I get the nodegit module with require('atom').GitRepositoryAsync.Git.


The latest version of ohnogit requires nodegit v0.12.2 or above. Atom specifies strictly v0.12.0 in the latest Stable release. This is possibly one reason why you’re getting the above error.


stfu, that totally worked! thanks guys.

Death to git screen scraping!


They removed nodegit in v1.9.0-beta1, which means that require('atom').GitRepositoryAsync.Git does not work anymore.
Has anyone managed to include nodegit as a package dependency?

I try to include it in a package but I get Cannot find module '../build/Debug/nodegit.node' and apm-beta install --verbose gives me warnings/errors like

npm WARN engine nodegit@0.12.0: wanted: {"node":">= 0.12"} (current: {"node":"0.10.40","npm":"2.13.3"})
node-pre-gyp ERR! stack Error: Unsupported target version: 0.37.8

EDIT: I thought the removal of GitRepositoryAsync and the apm update would happen in the same beta release. Sorry my mistake. It works in v1.10.0-beta0 :slight_smile: