我正在尝试使用 nodegit 克隆一个 repo,但我最终只克隆了.git
目录。我的其他文件都没有被下载。我在控制台中收到了这个错误:
Assertion failed: (t->cred), function on_headers_complete, file ../vendor/libgit2/src/transports/http.c, line 380.
Abort trap: 6
我为克隆 repo 编写的代码如下:
Git.Clone(this.options.remoteUrl, this.options.localDir, this.cloneOptions)
.then((repo) => {
if (repo instanceof Git.Repository) {
console.log('Cloned');
repo.checkoutRef('refs/head/master').then((reference) => {
console.log('Checkout master completed');
this.alreadyCloned = true;
this.busy = false;
cb(null, {});
});
} else {
console.error('Failed to clone the repo');
}
})
.catch((err) => {
console.error(err);
this.busy = false;
cb(err);
});
和克隆选项:
this.cloneOptions = {
fetchOpts: {
callbacks: {
certificateCheck() {
return 1;
},
credentials() {
return Git.sshKeyMemoryNew(
options.username,
options.publickey,
options.privatekey,
options.passphrase,
);
},
},
},
};
节点版本:v8.5.0 操作系统:MacOS High Sierra(已编辑)
除了:
options.publickey, // /Users/safa/.ssh/id_rsa.pub
options.privatekey, // /Users/safa/.ssh/id_rsa
提前致谢!