[英]Reading Git config variable using NodeGit
NodeGit似乎沒有提供任何API來檢索Git配置值。
參見http://www.nodegit.org/#Config
我期望使用類似Config#getValue()或類似的API來檢索配置值。
也許到目前為止,由於libgit2具有這些API,它在NodeGit中尚不存在。
有什么提示嗎?
這是獲取全局git config變量的示例:
var nodegit = require("nodegit");
nodegit.Config.openDefault()
.then(function (config) {
return config.getStringBuf('user.name');
})
.then(console.log);
這是獲取存儲庫配置變量的方法:
nodegit.Repository.open('PATH_TO_REPO')
.then(function (repository) {
return repository.config();
})
.then(function (config) {
return config.getStringBuf('user.name');
})
.then(console.log);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.