const Git = require("nodegit");
const conf = require('../config')
var opts = {
fetchOpts: {
callbacks: {
credentials: function () {
// works
return Git.Cred.userpassPlaintextNew(conf.account, conf.password)
//doesn't work
return Git.Cred.sshKeyNew( conf.myTokens, "x-oauth-basic");
},
certificateCheck: function () {
return 1;
}
}
}
};
function cloneGit (){
Git.Clone(conf.cur_git_path, "test",opts)
.then((repo) => {
console.log('repo done, repo.workdir', repo);
})
.catch((e) => {
console.log(e);
});
}
http://www.nodegit.org/api/cred/#userpassPlaintextNew
has nothing about Personal Access Tokens
thanks ~~
Maybe this example will help.
i've tried this, but there is a warning "Error: request failed with status code: 401 errno: -1"
have more descriptions about this method?
i tried like this, it's ok!
Git.Cred.sshKeyNew( conf.account, conf.myTokens);
https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/#using-a-token-on-the-command-line
would like to bump this, because this still seems to be an issue. I can't really get this working with an access token
nevermind, my issue seemed to be related to the scope of the token
Most helpful comment
i've tried this, but there is a warning "Error: request failed with status code: 401 errno: -1"
have more descriptions about this method?