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?
According to the new APIs from NodeGit@0.26.1
export const getRemoteUrl = async (path, remoteName) => {
try {
let repository = await nodegit.Repository.open(path);
let remoteObject = await repository.getRemote(remoteName);
let remoteUrl = await remoteObject.url();
return remoteUrl;
} catch (error) {
console.log(error);
}
};
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());
})
})
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.