简体   繁体   English

Nodegit克隆不起作用?

[英]Nodegit cloning not working?

I'm trying to use the Nodegit plugin to clone some git repos into a directory called 'tmp' so I can do things with the actual folder (upload it to a server). 我正在尝试使用Nodegit插件将一些git repos 克隆到名为“ tmp”的目录中,以便我可以使用实际文件夹进行操作(将其上传到服务器)。 Here's my code: 这是我的代码:

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); } );
}

All it does is create an empty directory called 'tmp' for a split second and deletes it. 它所做的只是瞬间创建一个名为“ tmp”的空目录并将其删除。 The errors I get are ./tmp' exists and is not an empty directory (but it does not exist?) and authentication required but no callback set . 我得到的错误是./tmp' exists and is not an empty directory (但不存在?)和authentication required but no callback set Anyone know how to fix these? 有人知道如何解决这些问题吗?

As @johnhaley81 mentioned in gitter, you should checkout the test code here . 正如@ johnhaley81在gitter中提到的,您应该在此处签出测试代码。 Overriding the certificateCheck should resolve The SSL certificate is invalid error. 覆盖certificateCheck应该解决The SSL certificate is invalid错误。

The ./tmp error makes sense, because you are trying to clone multiple repositories into the same directory. ./tmp错误很有意义,因为您试图将多个存储库克隆到同一目录中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM