Nodegit 克隆不起作用?

Nodegit cloning not working?

我正在尝试使用 Nodegit plugin to clone 一些 git 回购到一个名为 'tmp' 的目录中,这样我就可以对实际文件夹进行操作(将其上传到服务器)。这是我的代码:

var git = require('nodegit');

var repos = [some https repo urls]

var options = {
    remoteCallbacks: {
        certificateCheck: function() {
            return 1;
        }
    }
};

for(i = 0; i<repos.length; i++){
    git.Clone(repos[i], './tmp', options).catch(function(err) { console.error(err); } );
}

它所做的只是瞬间创建一个名为 'tmp' 的空目录并将其删除。我得到的错误是 ./tmp' exists and is not an empty directory(但它不存在?)和 authentication required but no callback set。有人知道如何解决这些问题吗?

正如 @johnhaley81 在 gitter 中提到的,你应该检查测试代码 here。覆盖 certificateCheck 应该可以解决 The SSL certificate is invalid 错误。

./tmp 错误是有道理的,因为您正试图将多个存储库克隆到同一目录中。