Questions tagged [nodegit]

nodegit is a collection of non-blocking Node.js libgit2 bindings, raw api, convenience api, unit tests, documentation and accomodations to make contributing easier.

NodeGit is a collection of non-blocking Node.js libgit2 bindings, raw api, convenience api, unit tests, documentation and accomodations to make contributing easier.

Official Website

API Documentation

110 questions
1
vote
0 answers

ReferenceError: repo is not defined when i try to open a repo with Nodegit

i get this error when i try to open my repository inside my react-redux project. My code is: var localPath = require("path").join(__dirname,"./app/repository/project0"); var nodegit =…
1
vote
1 answer

require("nodegit") prevents script from exiting

I'm having trouble using nodegit (v0.9.0). Any .js script that requires the package will hang forever and not exit. Example: var nodegit = require('nodegit'); console.log("hello world"); Running this on the command line will result in the expected…
laffoyb
  • 1,540
  • 3
  • 22
  • 35
1
vote
1 answer

How to reset staged and unstaged changes with nodegit

I'm trying to execute git reset --hard via nodegit after setting the HEAD to a detached state by doing the following: var oid = 'commit sha'; repo.setHeadDetached(oid); Reset.reset(repo, oid, Reset.TYPE.HARD); but without any success. Am I…
Adonis K. Kakoulidis
  • 4,951
  • 6
  • 34
  • 43
1
vote
1 answer

Manage git repo from node.js application

I need to manage a git repository from a Node.js application. Is there a git wrapper library or something that lets me call git functions high level and interpret the result without having to parse the console output?
Maikel Ruiz
  • 1,342
  • 2
  • 15
  • 25
1
vote
1 answer

nodegit: cloning private repository using GitHub API token is not working

I want to clone a private repository using nodegit, a npm package. I followed a guides for cloning private repository and set the clone options as fllows, cloneOptions: remoteCallbacks: certificateCheck: ()-> return 1 credentials: ()-> …
hitochan
  • 1,028
  • 18
  • 34
1
vote
1 answer

How to get commit and tree using Revparse with nodegit?

I'm trying to use nodegit to get the tree of a commit based on a reference or oid using Revparse, I thought the following code would work, however I'm getting getTree undefined errors: return git.Repository.open(path_to_repo) .then((repo) =>…
Paul Johnson
  • 1,329
  • 1
  • 12
  • 25
1
vote
1 answer

handling return values in promises nodejs

I have built this function in NodeJs, var Git = require('nodegit'); var fse = require('fs-extra'); var path = require('path'); var fs = require('fs'); var repoPath = 'D:\\sample' function gitCommitHistory(repoPath, callbackGitCommitHistory) { try…
Sritharan M
  • 43
  • 2
  • 13
1
vote
1 answer

How do I list the paths of the files that were changed in a commit?

I can currently walk a particular branch to get the details of the commits (i.e. author, timestamp, etc.) but I would like to also get the files that were affected by the commit. What I have tried: commit.getDiff().then(function(arrayDiff) { …
Jacob Schoen
  • 14,034
  • 15
  • 82
  • 102
1
vote
1 answer

Nodegit cloning not working?

I'm trying to use the Nodegit plugin to clone some git repos into a directory called 'tmp' so I can do things with the actual folder (upload it to a server). Here's my code: var git = require('nodegit'); var repos = [some https repo urls] var…
Bramt
  • 45
  • 1
  • 1
  • 9
1
vote
1 answer

Empty Head Reference Getting returned in NodeGit

Trying to access the HEAD reference using NodeGit. I am new to nodejs so this might simply be because I missed something. The following code finds the head but it always returns {}. Not sure what I am doing wrong. Code starts outside this file by…
Betsegaw
  • 141
  • 2
  • 9
0
votes
0 answers

Not able to get file versions in with nodegit package in nodejs

I am trying to get previous file versions and the persons who changed that fie by using the Nodegit module. Even though the file is existing in the repository I am getting ** file path "file_name" not existing in the given tree**. This is the…
Ram
  • 1
0
votes
1 answer

How to debug mysterious deletion of files in nodejs application?

I am developing a node application that uses nodegit to manage git repos. Every once in a while some files from the git repo mysteriously disappear and the repository stops being a valid git repo. If I performed any git command, I get following…
katboo
  • 55
  • 7
0
votes
1 answer

nodegit avoid creating empty commit nodejs bitbucket

I am using following code to create a commit using nodegit library of nodejs function createCommit(commitMsg) { console.log("Creating commit"); let repository, index, oid, author, committer; return NodeGit.Repository.open(bb.repoPath) …
Sunil Garg
  • 14,608
  • 25
  • 132
  • 189
0
votes
1 answer

nodegit bitbucket commit is not working properly nodejs

I am trying to push changes to bitbucket repo using nodegit npm package. Here is the code async function createCommit1(commitMsg) { try { const repo = await NodeGit.Repository.open(bb.repoPath); const index = await repo.refreshIndex(); //…
Sunil Garg
  • 14,608
  • 25
  • 132
  • 189
0
votes
0 answers

Is there a way to provide a custom merge function to nodegit?

With Nodegit, can I can pass a custom merge callback that will get called whenever there is a merge conflict? The Merge.merge function accepts mergeOpts, which has a variable named 'defaultDriver' with type 'string'. But I am not able to findout any…
katboo
  • 55
  • 7