Created
September 26, 2016 10:36
-
-
Save vital101/28f534d6e26d71afe547855533a01d66 to your computer and use it in GitHub Desktop.
NodeGit Clone Private with Token
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const repo = 'vital101/kernl-example-plugin-gitub'; | |
const token = 'my-token-from-oauth'; | |
const cloneURL = `https://${token}:[email protected]/${repository}`; | |
const cloneOptions = { | |
fetchOpts: { | |
callbacks: { | |
certificateCheck: () => { return 1; }, | |
credentials: () => { | |
return NodeGit.Cred.userpassPlaintextNew(token, 'x-oauth-basic'); | |
} | |
} | |
}; | |
const cloneRepository = NodeGit.Clone(cloneURL, '/path/to/clone/in/to', cloneOptions); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment