1

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). 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. 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. Anyone know how to fix these?

Bramt
  • 45
  • 1
  • 1
  • 9
  • I haven't used the project, but looking at the docs NodeGit seems to support promises, so add an error case handler with something like `git.Clone(repos[i], './tmp).catch(function(err) { console.log(err); } );` to see what's going wrong. – orbitbot Apr 06 '15 at 21:00
  • Thanks @orbitbot. I added the error case and updated the op with the errors. – Bramt Apr 06 '15 at 21:43

1 Answers1

1

As @johnhaley81 mentioned in gitter, you should checkout the test code here. Overriding the certificateCheck should resolve The SSL certificate is invalid error.

The ./tmp error makes sense, because you are trying to clone multiple repositories into the same directory.

mhcuervo
  • 2,610
  • 22
  • 33