Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Nov 21 17:53

    ianhattendorf on master

    Fix tag createWithSignature fun… Add deprecation warning Update createWithSignature func… and 1 more (compare)

  • Nov 21 17:53
    ianhattendorf closed #1945
  • Nov 18 16:43
    PabloYG commented #1816
  • Nov 18 16:16
    PabloYG commented #1816
  • Nov 18 16:15
    PabloYG commented #1816
  • Nov 15 15:15
    mzedeler commented #1753
  • Nov 11 16:31

    ianhattendorf on v0.28.0-alpha.20


  • Nov 11 16:31

    ianhattendorf on master

    Bump to v0.28.0-alpha.20 (compare)

  • Nov 11 16:23

    ianhattendorf on master

    hopefully fix build issues Merge pull request #1955 from z… (compare)

  • Nov 11 16:23
    ianhattendorf closed #1955
  • Nov 10 09:37
    xmedeko commented #914
  • Nov 09 23:09
    zawata edited #1955
  • Nov 09 21:39
    zawata edited #1955
  • Nov 09 20:09
    zawata opened #1955
  • Nov 09 14:09
    julianmesa-gitkraken synchronize #1945
  • Nov 09 13:32
    julianmesa-gitkraken synchronize #1945
  • Nov 09 13:31
    julianmesa-gitkraken synchronize #1946
  • Nov 09 13:15
    julianmesa-gitkraken synchronize #1944
  • Nov 09 13:13
    julianmesa-gitkraken ready_for_review #1944
  • Nov 09 13:13
    julianmesa-gitkraken edited #1944
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

Hey, I'm trying to checkout a particular commit SHA. While I can it is being updated via git rev-parse HEAD the file system is staying the same as when it was pulled. This is the code I'm using that I found in a SO post

await Git.Checkout.tree(this.repo, this.argv.commitSha, { checkoutStrategy: Git.Checkout.STRATEGY.SAFE_CREATE }); await this.repo.setHeadDetached(this.argv.commitSha, this.repo.defaultSignature, `Checkout: HEAD ${this.argv.commitSha}`);

Vedant Mohan Goyal
Hello everyone, I am a newbie and creating a GitHub Action using NodeJS. I have some un-staged changes on the cloned repository, and I want to make a new branch, commit the changes, and push them to remote (GitHub) using a personal access token (PAT). Please tell me how to do it.
Vedant Mohan Goyal
Please reply as soon as possible 🙏
Hey guys wanted to ask a question: I've seen cloned a repo and I wanna download the diff between my current version and the uptodate version. They are all jpg that's why I wanna do this. There's a way to do it or I have always to clone the last repository?
Anyone has a working example of cloning from a private repository with GitHub? It worked like a charm on my computer but it doesn't on my remote server and I can't figure out why.
Matt Stam
Hi folks, would anyone happen to have a clue why with fairly standard attempts to clone a remote repo, the close succeeds but the .git is totally empty?
For example form this
        const repo = await Repository.init(`./my-repo`, 0);
        const remote = await Remote.createWithFetchspec(
        await repo.fetchAll();