Title: Remote object is null · Issue #915 · nodegit/nodegit · GitHub
Open Graph Title: Remote object is null · Issue #915 · nodegit/nodegit
X Title: Remote object is null · Issue #915 · nodegit/nodegit
Description: Version: 0.11.3 Use repo.getRemote("origin") It return like {"_55":0,"_87":null,"_28":[]}, and can't use remote.push. Use Git.Remote.create If I use Git.Remote.create(repo, "origin", "https://" + GITHUB_TOKEN + ":x-oauth-basic@github.com...
Open Graph Description: Version: 0.11.3 Use repo.getRemote("origin") It return like {"_55":0,"_87":null,"_28":[]}, and can't use remote.push. Use Git.Remote.create If I use Git.Remote.create(repo, "origin", "https://" + G...
X Description: Version: 0.11.3 Use repo.getRemote("origin") It return like {"_55":0,"_87":null,"_28":[]}, and can't use remote.push. Use Git.Remote.create If I use Git....
Opengraph URL: https://github.com/nodegit/nodegit/issues/915
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Remote object is null","articleBody":"Version: 0.11.3\n### Use `repo.getRemote(\"origin\")`\n\nIt return like `{\"_55\":0,\"_87\":null,\"_28\":[]}`, and can't use `remote.push`.\n### Use `Git.Remote.create`\n\nIf I use `Git.Remote.create(repo, \"origin\", \"https://\" + GITHUB_TOKEN + \":x-oauth-basic@github.com/abc/def\")`, it return `null`.\n\n``` javascript\nvar express = require('express');\nvar Git = require(\"nodegit\");\nvar fs = require('fs');\nvar router = express.Router();\nvar GITHUB_TOKEN = process.env.GITHUB_TOKEN;\nvar FILE_NAME = \"index.htm\";\nvar content;\nvar repo;\nvar head;\nvar oid;\n\nrouter.post('/issues', function(req, res, next) {\n Git.Clone(\"https://\" + GITHUB_TOKEN + \":x-oauth-basic@github.com/abc/def\", \"./tmp\", {\n checkoutBranch: \"gh-pages\"\n }).then(function(repoResult){\n repo = repoResult;\n\n console.log(\"getHeadCommit\");\n\n return repo.getHeadCommit();\n }).then(function(headResult){\n head = headResult;\n console.log(\"getEntry\");\n\n return head.getEntry(FILE_NAME);\n }).then(function(entry){\n console.log(\"getBlob\");\n\n return entry.getBlob();\n }).then(function(blob){\n content = \"DEF\" + String(blob) + \"ABC\";\n\n fs.writeFileSync(\"./tmp/\" + FILE_NAME, content);\n\n return repo.index();\n }).then(function(index){\n index.addByPath(FILE_NAME);\n index.write();\n\n return index.writeTree();\n }).then(function(oidResult){\n oid = oidResult;\n\n var author = Git.Signature.now(\"kewang\", \"cpckewang@gmail.com\");\n\n return repo.createCommit(\"HEAD\", author, author, \"Add test\", oid, [head]);\n }).then(function(commitId){\n console.log(\"New Commit: \" + commitId);\n\n var remote = repo.getRemote(\"origin\");\n\n // var remote = Git.Remote.create(repo, \"origin\", \"https://\" + GITHUB_TOKEN + \":x-oauth-basic@github.com/abc/def\");\n\n console.log(\"remote: \" + remote);\n\n return remote.push([\"refs/heads/master:refs/heads/master\"]);\n }).done(function(){\n console.log(\"Push OK\");\n\n return res.json(content);\n });\n});\n\nmodule.exports = router;\n```\n","author":{"url":"https://github.com/kewang","@type":"Person","name":"kewang"},"datePublished":"2016-02-23T18:37:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/915/nodegit/issues/915"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:da5a99be-a072-5c00-9d0b-71edcffc1aed |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A648:3E383E:81E408:A8EACA:6A600164 |
| html-safe-nonce | d3a9ed6e1e15cc3be8745bc736ec58fbbb0cb76ee048fd396a27f402987b2614 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjQ4OjNFMzgzRTo4MUU0MDg6QThFQUNBOjZBNjAwMTY0IiwidmlzaXRvcl9pZCI6IjkwOTAyNzMwMTIxODExMDcwNDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d1effd03ae0d8b0a33d89e5be9fddf922a624b9ec11b8cea6a11134a39d32780 |
| hovercard-subject-tag | issue:135824472 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodegit/nodegit/915/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e223bafbc688388a88ed25a3fb0b23cab483f5ce3c501012d79b1e773eb244ff/nodegit/nodegit/issues/915 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e223bafbc688388a88ed25a3fb0b23cab483f5ce3c501012d79b1e773eb244ff/nodegit/nodegit/issues/915 |
| og:image:alt | Version: 0.11.3 Use repo.getRemote("origin") It return like {"_55":0,"_87":null,"_28":[]}, and can't use remote.push. Use Git.Remote.create If I use Git.Remote.create(repo, "origin", "https://" + G... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kewang |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5789899e92b20db289de946d86eb20bf5c9626276695d68f58a8c47cdda699b7 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodegit/nodegit git https://github.com/nodegit/nodegit.git |
| octolytics-dimension-user_id | 657068 |
| octolytics-dimension-user_login | nodegit |
| octolytics-dimension-repository_id | 1383170 |
| octolytics-dimension-repository_nwo | nodegit/nodegit |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1383170 |
| octolytics-dimension-repository_network_root_nwo | nodegit/nodegit |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6ddc048ddf80664b9b33547b619db10313c482f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width