Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Sep 24 06:26
    mkastner commented #1840
  • Sep 23 14:07
    thomas-z-meyer-db opened #1861
  • Sep 17 22:50
    ianhattendorf synchronize #1860
  • Sep 17 22:28
    ianhattendorf synchronize #1860
  • Sep 17 21:59
    ianhattendorf synchronize #1860
  • Sep 17 21:17
    ianhattendorf synchronize #1860
  • Sep 17 21:01
    ianhattendorf synchronize #1860
  • Sep 17 19:39
    ianhattendorf synchronize #1860
  • Sep 17 19:26
    ianhattendorf synchronize #1860
  • Sep 17 19:11
    ianhattendorf synchronize #1860
  • Sep 17 18:47
    ianhattendorf synchronize #1860
  • Sep 17 18:44
    ianhattendorf synchronize #1860
  • Sep 17 18:43
    ianhattendorf synchronize #1860
  • Sep 17 18:41
    ianhattendorf opened #1860
  • Sep 16 23:47
    weedz commented #1855
  • Sep 16 08:59
    JackTn commented #1855
  • Sep 16 08:59
    JackTn commented #1855
  • Sep 16 08:56
    JackTn synchronize #1855
  • Sep 16 06:47
    JackTn edited #1855
  • Sep 16 06:18
    JackTn edited #1855
Rajeshkannan R
in mac
Randy Wilander
Hey there. Is there a way emulate the --push-option parameter when doing a push using nodegit? I could not find anything while looking into the docs. I am trying to emulate the following git push -o nolint. I found https://www.nodegit.org/api/push_options/ but not sure this is what I want.
Sumit Patel
@all is there any way were i can get file commit difference in view like bitbucket?
Sumit Patel
@all Can i access https bare file using nodegit openBare?
Mark Schmidt

I can't seem to create a local branch and then set the upstream to origin. It's easier to point you to my stackoverflow question as there is too much detail to put into a chat message.


Sumit Patel
can i get source code from git bare folder using nodegit to show in web ui?
Marc J. Schmidt
Hey, is it still needed to call everywhere .free() to avoid memory leaks? I see in the @types/nodegit is still free() declared but it throws an error since the method doesn't exist anymore.
Tim Branyen
@marcj its been a while, but I'm almost positive nodegit tracks references and auto frees now
I wasn't aware the method was removed though
Marc J. Schmidt

@tbranyen thanks! yeah I'm also wondering.

const repo = await Repository.open(localPath);

TypeError: repo.free is not a function

Hello Team
I want to add file in git bare using repo open with openbare function
Anyone have idea are that?
Yun Sung Hyeon
I want to get the contents of conflict file after merge.
(File containing conflict markers (<<<<<<< ==== >>>>>>>))
How do I get the above from an index entry?
Does everyone know if the Worktree.add (experimental) works at all in nodegit? I keep on getting Assertions no matter what parameters I pass: Expression: object->InternalFieldCount(0) >0 Iam ready to give up. Any help would be appreciated. Thanks.

Hi everyone. I'm getting a hard time using nodegit in an electron environment. It's not an installation problem nor a compilation problem because I can get it to work in some way...

Currently, all calls to nodegit are executing in the main process. It's being called with IPC messages. So far so good...

But my caller needs to access to the full class of, for example, Repository. When we send the response via IPC, it's getting serialized. So, at the other end of the line, I get just an empty object.

What can I do?

I tried to use nodegit directly in the renderer, but it needs a callback for authentication and it looks like the callback is not properly called with it's in the renderer...

Luc Shelton
Hey, is there anyway to get a list of a commits that have been made locally, but have not been pushed yet? I know there are git commands available, but I can't figure out the mapping to nodegit.
Luc Shelton
Also seem to be encountering a problem at the moment where Repository.open is returning empty Repository objects. Wondering if anyone else has experienced this.
vipul chakravarthy
Unable to install nodegit on ubuntu 18.04.
A'braham Barakhyahu
Is nodegit good for scripting workflows? Like merging multiple branches into a new branch. Just came across this library and wasn't sure if it has been used for something like that.
Len Dierickx

Hi, I am looking for some help on how to add files in a new directory. The behavior I am getting is that the directory is created, but the file is at the same level, not inside the directory. Additionally everything in the root is moved to the directory, and the code finished without committing. I am a bit confused here.

What I am looking for is:

I have a gist here: https://gist.github.com/astuanax/e35631c7633cd27040e9ac28a86f35bf
Not sure if this is the right place to ask such questions?
大家好 我是行业新人 来自中国 请多指教

Hello, I am trying to use git rever.Revert but I get this error: [Error: 1 uncommitted change would be overwritten by merge]. I wanna force revert and I am using this code.

const checkOpts = {
      checkoutStrategy: Git.Checkout.STRATEGY.FORCE || Git.Checkout.STRATEGY.RECREATE_MISSING || Git.Checkout.STRATEGY.ALLOW_CONFLICTS || Git.Checkout.STRATEGY.USE_THEIRS,
await Git.Revert.revert(repo, revertCommit, {
        checkoutOpts: checkOpts,
        mergeOpts: {
          fileFavor: Git.Merge.FILE_FAVOR.THEIRS

Any help would be highly appreciated

Anyone would have a sample to demonstrate a checkout of a remote branch locally commit a file and then push to the remote repo ?
Hi! is this an active channel?
Antonio Lopez
How do I use NodeGit.Graph.aheadBehind? I can't find any examples
Nitish Agarwal
Hi, I have just started trying out NodeGit. Is there any equivalent of git ls-files?
Ankit Muchhala
Hey! Has anyone use nodegit on production servers? Looking for some production insights.
Amber Schwartz
Hi all :)
Has anyone used nodegit with AWS code commit using SSH?
Kobi Bar Hanin
Hi! I’ve built an interactive git cli - igit. Check it out: https://github.com/kobibarhanin/igit to install: pip install igit
Wess Cope
hi all
jumped in here to trouble you nice folks. I pulling my hair, and prolly missing something obvious. But it doesn't matter what credentials i use, i either get no callbacks or failed init SSH Creds. Have also tried my github oauth token with username/pass
I want to tap the progress of clone and fetch all.
Now build an app on node git about read gitbooks locally
It's so wired, I can call nodegit in ordinary nodejs npm folder, but can not call nodegit under electron environment.

Hey all,
I tried to use nodegit in a Docker container with alpine-12. I installed nodegit version 0.26.5. For building I used

apk --update --no-cache -q add build-base libgit2-dev krb5 pcre python3 krb5-dev

and later on for running

apk --update --no-cache -q add krb5 krb5-dev

This was working fine when using Cred.sshKeyNew(...) for authentication. When we switched the git server I had to start using access tokens using Cred.userpassPlaintextNew(...) to authenticate. This worked fine on my Mac but gives me segmenation faults in the alpine container. I've been trying to google but could not come up with a solution. (I also tried with the packages suggested in https://github.com/nodegit/nodegit/issues/1361#issuecomment-369434539) Does anyone have an idea?

@cauchyfant have you solved the issue ?

Hey all,

I am having trouble getting nodegit to check out a tag correctly. No matter what I do I seem to be unable to get the tag be cleanly checked out - for some reason I always end up with 'changes not staged for commit' when the work tree should be clean. Here is the code:

const projectRoot = 'path/to/repo'; 
const tagName = 'v0.2.0';
const repo = await NodeGit.Repository.open(projectRoot);
  const status = await repo.getStatus();

  const tag = await repo.getTagByName(tagName).catch(() => false);
  const commit = await NodeGit.Commit.lookup(repo, tag.targetId());

  if(tag && !status.length) {
    await NodeGit.Checkout.tree(repo, commit, { checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE });
    await repo.setHeadDetached(commit, repo.defaultSignature, "Checkout: HEAD " + commit.id());

Can anyone explain why I am seeing 'changes not staged for commit' rather than a clean work tree checked out at the commit? It does say 'HEAD detatched at 74f20e2' and '74f20e2' is the correct sha for the commit the tag v0.2.0 points to

1 reply
Can someone help with how to clone the particular tag of the repo ??
I have tried the checkoutBranch options but it s not working to clone the tags
Any other way to achieve tis??
Sergio Fernández
Hi all, while doing clone and push operations to a SSH server in a docker container, I alway get "Failed to retrieve list of SSH authentication methods: Failed getting response". I tried generating SSH keys with PEM format and checking permissions and no solution at all.
1 reply
Adam Goldschmidt
Hey! Trying to add a worktree and create a new branch inside it. The corresponding git command is: git worktree add -b NEW_BRANCH_NAME ../session2. Is it possible? If not, how can I create a new branch and checkout into it (checkout doesn't have that option)?
Soumyadip Chowdhury
Hi, how chan I checkout remote branch using nodegit ?
请问 nodegit 可以 在不检出 这个仓库的 情况下, 进行 将某个文件 提交到那个仓库中吗
Rhey Anthony Laurente
Hi guys is there a way I can use this with cordova / capacitor ?
currently I able to port nodejs in cordova using this plugin https://code.janeasystems.com/nodejs-mobile/getting-started-cordova
but when I tried testing clone function, I stuck with the ".node has bad ELF magic" issue
I see there were ways to port in electronjs, was thinking if there's a way too for capacitor / cordova thanks