Skip to content

Commit 7074dfa

Browse files
committed
Fix clone options in cloneFromGithubWith2Factor example
1 parent f6085e9 commit 7074dfa

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

examples/cloneFromGithubWith2Factor.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,18 @@ var repoName = "{The name of the repo}";
1111
// over https, it can't be done with actual 2 factor.
1212
// https://github.com/blog/1270-easier-builds-and-deployments-using-git-over-https-and-oauth
1313

14-
// The token has to be included in the URL if the repo is private.
15-
// Otherwise, github just wont respond, so a normal credential callback
16-
// wont work.
17-
var repoUrl = "https://" + token +
18-
":x-oauth-basic@github.com/" +
19-
repoOwner + "/" +
20-
repoName + ".git";
21-
2214
// If the repo is public, you can use a callback instead
2315
var repoUrl = "https://github.com/" + repoOwner + "/" + repoName + ".git";
2416

2517
var opts = {
26-
remoteCallbacks: {
27-
credentials: function() {
28-
return nodegit.Cred.userpassPlaintextNew (token, "x-oauth-basic");
29-
},
30-
certificateCheck: function() {
31-
return 1;
18+
fetchOpts: {
19+
callbacks: {
20+
credentials: function() {
21+
return nodegit.Cred.userpassPlaintextNew(token, "x-oauth-basic");
22+
},
23+
certificateCheck: function() {
24+
return 1;
25+
}
3226
}
3327
}
3428
};

0 commit comments

Comments
 (0)