Javascript 使用NodeGit克隆存储库时忽略.gitconfig
我正在尝试使用从私有存储库下载一些应用程序教程。我正在使用令牌进行身份验证,并通过https下载它们。问题是,如果用户设置了Javascript 使用NodeGit克隆存储库时忽略.gitconfig,javascript,git,coffeescript,git-config,nodegit,Javascript,Git,Coffeescript,Git Config,Nodegit,我正在尝试使用从私有存储库下载一些应用程序教程。我正在使用令牌进行身份验证,并通过https下载它们。问题是,如果用户设置了 [url "git@github.com:"] insteadOf = https://github.com/ 在.gitconfig中,它将失败,并返回回调不支持的凭据类型错误。我尝试使用API,但不确定是否正确,因为文档中没有对此的描述 这是我的密码: fse = require 'fs-extra' Git = require 'nodeg
[url "git@github.com:"]
insteadOf = https://github.com/
在.gitconfig
中,它将失败,并返回回调不支持的凭据类型错误。我尝试使用API,但不确定是否正确,因为文档中没有对此的描述
这是我的密码:
fse = require 'fs-extra'
Git = require 'nodegit'
...
cloneOpts =
fetchOpts:
callbacks:
certificateCheck: => 1
credentials: (url, userName) =>
return Git.Cred.userpassPlaintextNew(myUser, myToken)
transferProgress: (stats) =>
p = (stats.receivedObjects() + stats.indexedObjects()) / (stats.totalObjects() * 2)
try
progress p
catch error
console.log error
fse.remove dstPath, (err) =>
Git.Clone(tutorial.uri, dstPath, cloneOpts)
.then((repo) =>
console.log 'success')
.catch((error) =>
console.log error.message)
如何使NodeGit忽略用户的.gitconfig