我正在尝试使用库 nodegit(0.2.4 版)和 ssh 从 node.js 中的 teamforge 服务器克隆 git 存储库。我们的服务器向用户请求身份验证,当我尝试仅使用克隆方法而不传递选项时,我收到错误消息:“回调无法初始化 SSH 凭据”。
我在文件 private.key 和 public.key 中有私钥和公钥。它们位于我在网络风暴中设置为工作目录的目录中,因此位置应该不是问题。
没有找到如何做的例子(也许我错过了),但下面的代码是我得到的最接近的:
'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;
}
);
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
TypeError: Object #<Object> has no method 'isFulfilled' at value
(c:\...\proj\node_modules\nodegit\node_modules\nodegit-promise\lib\core.js:36:15)
Run Code Online (Sandbox Code Playgroud)
你有什么提示可能是错误的或一般如何做吗?