Skip to content

Commit 5ec02f5

Browse files
committed
Fix clone options on guides
1 parent 7074dfa commit 5ec02f5

6 files changed

Lines changed: 46 additions & 30 deletions

File tree

guides/cloning/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ to passthrough the certificate check.
8383
*Note: this is not a problem with Windows or Linux*
8484

8585
``` javascript
86-
cloneOptions.remoteCallbacks = {
87-
certificateCheck: function() { return 1; }
86+
cloneOptions.fetchOpts = {
87+
callbacks: {
88+
certificateCheck: function() { return 1; }
89+
}
8890
};
8991
```
9092

guides/cloning/gh-two-factor/README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ to passthrough the certificate check.
9999
*Note: this is not a problem with Windows or Linux*
100100

101101
``` javascript
102-
cloneOptions.remoteCallbacks = {
103-
certificateCheck: function() { return 1; }
102+
cloneOptions.fetchOpts = {
103+
callbacks: {
104+
certificateCheck: function() { return 1; }
105+
}
104106
};
105107
```
106108

@@ -112,13 +114,15 @@ callback that expects credentials to be passed.
112114
This function will be attached below the above `certificateCheck`, and will
113115
respond back with the OAuth token.
114116

115-
The `remoteCallbacks` object now looks like this:
117+
The `fetchOpts` object now looks like this:
116118

117119
``` javascript
118-
cloneOptions.remoteCallbacks = {
119-
certificateCheck: function() { return 1; },
120-
credentials: function() {
121-
return NodeGit.Cred.userpassPlaintextNew(GITHUB_TOKEN, "x-oauth-basic");
120+
cloneOptions.fetchOpts = {
121+
callbacks: {
122+
certificateCheck: function() { return 1; },
123+
credentials: function() {
124+
return NodeGit.Cred.userpassPlaintextNew(GITHUB_TOKEN, "x-oauth-basic");
125+
}
122126
}
123127
};
124128
```

guides/cloning/gh-two-factor/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ var cloneOptions = {};
2020

2121
// This is a required callback for OS X machines. There is a known issue
2222
// with libgit2 being able to verify certificates from GitHub.
23-
cloneOptions.remoteCallbacks = {
24-
certificateCheck: function() { return 1; },
25-
credentials: function() {
26-
return NodeGit.Cred.userpassPlaintextNew(GITHUB_TOKEN, "x-oauth-basic");
23+
cloneOptions.fetchOpts = {
24+
callbacks: {
25+
certificateCheck: function() { return 1; },
26+
credentials: function() {
27+
return NodeGit.Cred.userpassPlaintextNew(GITHUB_TOKEN, "x-oauth-basic");
28+
}
2729
}
2830
};
2931

guides/cloning/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ var cloneOptions = {};
1616

1717
// This is a required callback for OS X machines. There is a known issue
1818
// with libgit2 being able to verify certificates from GitHub.
19-
cloneOptions.remoteCallbacks = {
20-
certificateCheck: function() { return 1; }
19+
cloneOptions.fetchOpts = {
20+
callbacks: {
21+
certificateCheck: function() { return 1; }
22+
}
2123
};
2224

2325
// Invoke the clone operation and store the returned Promise.

guides/cloning/ssh-with-agent/README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ to passthrough the certificate check.
8181
*Note: this is not a problem with Windows or Linux*
8282

8383
``` javascript
84-
cloneOptions.remoteCallbacks = {
85-
certificateCheck: function() { return 1; }
84+
cloneOptions.fetchOpts = {
85+
callbacks: {
86+
certificateCheck: function() { return 1; }
87+
}
8688
};
8789
```
8890

@@ -95,13 +97,15 @@ This function will be attached below the above `certificateCheck`, and will
9597
respond back with the credentials from the agent. You'll notice we handle
9698
the second argument passed to credentials, `userName`.
9799

98-
The `remoteCallbacks` object now looks like this:
100+
The `fetchOpts` object now looks like this:
99101

100102
``` javascript
101-
cloneOptions.remoteCallbacks = {
102-
certificateCheck: function() { return 1; },
103-
credentials: function(url, userName) {
104-
return NodeGit.Cred.sshKeyFromAgent(userName);
103+
cloneOptions.fetchOpts = {
104+
callbacks: {
105+
certificateCheck: function() { return 1; },
106+
credentials: function(url, userName) {
107+
return NodeGit.Cred.sshKeyFromAgent(userName);
108+
}
105109
}
106110
};
107111
```

guides/cloning/ssh-with-agent/index.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ var cloneOptions = {};
1515

1616
// This is a required callback for OS X machines. There is a known issue
1717
// with libgit2 being able to verify certificates from GitHub.
18-
cloneOptions.remoteCallbacks = {
19-
certificateCheck: function() { return 1; },
20-
21-
// Credentials are passed two arguments, url and username. We forward the
22-
// `userName` argument to the `sshKeyFromAgent` function to validate
23-
// authentication.
24-
credentials: function(url, userName) {
25-
return NodeGit.Cred.sshKeyFromAgent(userName);
18+
cloneOptions.fetchOpts = {
19+
callbacks: {
20+
certificateCheck: function() { return 1; },
21+
22+
// Credentials are passed two arguments, url and username. We forward the
23+
// `userName` argument to the `sshKeyFromAgent` function to validate
24+
// authentication.
25+
credentials: function(url, userName) {
26+
return NodeGit.Cred.sshKeyFromAgent(userName);
27+
}
2628
}
2729
};
2830

0 commit comments

Comments
 (0)