Nodegit https 认证
Nodegit https auth
我正在尝试实现 nodegit 以使用 gitlab 进行回购控制,但是我需要使用基本的用户名密码身份验证,并且文档仅使用 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);
});
我该怎么做?
最终通过子进程实施 git。 Nodegit 库有很多问题,包括锁定目录,这样即使函数返回后您也无法删除它们。
我正在尝试实现 nodegit 以使用 gitlab 进行回购控制,但是我需要使用基本的用户名密码身份验证,并且文档仅使用 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);
});
我该怎么做?
最终通过子进程实施 git。 Nodegit 库有很多问题,包括锁定目录,这样即使函数返回后您也无法删除它们。