I'm trying to clone git repository from our teamforge server in node.js using library nodegit (version 0.2.4) and ssh. Our server requests authentication from user and when I was trying to use only clone method without passing options I was getting error: "Callback failed to initialize SSH credentials".
I have private and public key in files private.key and public.key. They're in directory which I have set to working directory in web storm, so location shouldn't be a problem.
Didn't find example how to do it (maybe I missed it), but below code is the closest which I got:
'use strict';
var nodegit = require("nodegit"),
Clone = nodegit.Clone,
cred = nodegit.Cred;
var options = {
remoteCallbacks: {
credentials: function () {
return cred.sshKeyNew('user', 'public.key', 'private.key', '');
}
}
};
Clone.clone("ssh://user@teamforgeserver.net/reponame", "localTmp", options)
.then(function(repo) {
var r = repo;
},
function(err){
var e = err;
}
);
I'm getting this error:
TypeError: Object #<Object> has no method 'isFulfilled' at value
(c:\...\proj\node_modules\nodegit\node_modules\nodegit-promise\lib\core.js:36:15)
Do you have hint what could be wrong or how to do it in general?