node.jsnodegit

Getting git repository url with nodegit


i'm using the nodegit library to get all commits from my repository, and i want to get general information from the local repository as for example:

Is it possible?


Solution

  • It is almost the same as you would do in git:

    nodegit.Repository.open(".git").then(repo => {
        repo.config().then(config => {
            config.getStringBuf("remote.origin.url").then(buf => {
                console.log(buf.toString());
            })
        })
    });