| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,6 +10,7 @@ var fileContent = "hello world"; | |||
| 10 | 10 | var repoDir = "../../newRepo"; | |
| 11 | 11 | ||
| 12 | 12 | var repository; | |
| 13 | + var remote; | ||
| 13 | 14 | ||
| 14 | 15 | var signature = nodegit.Signature.create("Foo bar", | |
| 15 | 16 | "foo@bar.com", 123456789, 60); | |
@@ -47,15 +48,18 @@ fse.remove(path.resolve(__dirname, repoDir)) | |||
| 47 | 48 | .then(function() { | |
| 48 | 49 | return nodegit.Remote.create(repository, "origin", | |
| 49 | 50 | "git@github.com:nodegit/push-example.git") | |
| 50 | - .then(function(remote) { | ||
| 51 | - remote.connect(nodegit.Enums.DIRECTION.PUSH); | ||
| 51 | + .then(function(remoteResult) { | ||
| 52 | + remote = remoteResult; | ||
| 52 | 53 | ||
| 53 | 54 | remote.setCallbacks({ | |
| 54 | 55 | credentials: function(url, userName) { | |
| 55 | 56 | return nodegit.Cred.sshKeyFromAgent(userName); | |
| 56 | 57 | } | |
| 57 | 58 | }); | |
| 58 | 59 | ||
| 60 | + return remote.connect(nodegit.Enums.DIRECTION.PUSH); | ||
| 61 | + }) | ||
| 62 | + .then(function() { | ||
| 59 | 63 | // Create the push object for this remote | |
| 60 | 64 | return remote.push( | |
| 61 | 65 | ["refs/heads/master:refs/heads/master"], | |
| Back | FazBrowse Home | New Git URL |
0 commit comments