当我尝试在我的 react-redux 项目中打开我的存储库时出现此错误。我的代码是:
var localPath = require("path").join(__dirname,"./app/repository/project0");
var nodegit = require('nodegit');
console.log(localPath);
nodegit.Repository.open(localPath)
.then(function(repoResult) {
repo = repoResult;
return repoResult.openIndex();
}, function (reasonForFailure) {
res.json({message: reasonForFailure})
console.log(reasonForFailure)
}
我确定路径是正确的。我还尝试多次更改路径,明确 .git 文件夹,但它仍然不起作用。谢谢您的帮助!