我试图用gitlab实现nodegit进行repo控制,但是我需要使用基本的用户名密码验证,文档只使用ssh。我试过使用Cred.userpassPlaintextNew,但我得到[错误:重定向或身份验证重放太多],如下所示:
var nodegit = require('nodegit'),
path = require('path');
var url = "https://gitlab.com/myuser/myrepo.git",
local = "./clone",
cloneOpts = {
fetchOpts: {
callbacks: {
credentials: function() {
return nodegit.Cred.userpassPlaintextNew('myuser','mypass')
}
}
}
};
nodegit.Clone(url, local, cloneOpts).then(function (repo) {
console.log("Cloned " + path.basename(url) + " to " + repo.workdir());
}).catch(function (err) {
console.log(err);
});
我该怎么做?
答案 0 :(得分:1)
通过子进程结束实现git。 Nodegit库有许多问题,包括锁定目录,因此即使在函数返回后也无法删除它们。