Title: "Error: Reference 'refs/heads/master' not found " when create commit in a empty repo · Issue #213 · nodegit/nodegit · GitHub
Open Graph Title: "Error: Reference 'refs/heads/master' not found " when create commit in a empty repo · Issue #213 · nodegit/nodegit
X Title: "Error: Reference 'refs/heads/master' not found " when create commit in a empty repo · Issue #213 · nodegit/nodegit
Description: Hi, I have init a repo with the code: git.Repo.init(resourcePath,false,function(initReporError, repo){ if (initReporError) throw initReporError; console.log("Repo init : "+repo); } Then I create commit with the code: git.Repo.open(path.r...
Open Graph Description: Hi, I have init a repo with the code: git.Repo.init(resourcePath,false,function(initReporError, repo){ if (initReporError) throw initReporError; console.log("Repo init : "+repo); } Then I create co...
X Description: Hi, I have init a repo with the code: git.Repo.init(resourcePath,false,function(initReporError, repo){ if (initReporError) throw initReporError; console.log("Repo init : "+repo); } Then I...
Opengraph URL: https://github.com/nodegit/nodegit/issues/213
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"\"Error: Reference 'refs/heads/master' not found \" when create commit in a empty repo","articleBody":"Hi, I have init a repo with the code:\n\n```\ngit.Repo.init(resourcePath,false,function(initReporError, repo){\n if (initReporError) \n throw initReporError;\n console.log(\"Repo init : \"+repo);\n}\n```\n\nThen I create commit with the code:\n\n```\ngit.Repo.open(path.resolve(__dirname, '../.git'), function(openReporError, repo) {\n if (openReporError) throw openReporError;\n\n //add the file to the index...\n repo.openIndex(function(openIndexError, index) {\n if (openIndexError) throw openIndexError;\n\n index.read(function(readError) {\n if (readError) throw readError;\n\n index.addByPath(fileName, function(addByPathError) {\n if (addByPathError) throw addByPathError;\n\n index.write(function(writeError) {\n if (writeError) throw writeError;\n\n index.writeTree(function(writeTreeError, oid) {\n if (writeTreeError) throw writeTreeError;\n\n //get HEAD\n git.Reference.oidForName(repo, 'HEAD', function(oidForName, head) {\n if (oidForName) throw oidForName;\n\n //get latest commit (will be the parent commit)\n repo.getCommit(head, function(getCommitError, parent) {\n if (getCommitError) throw getCommitError;\n var author = git.Signature.create(\"Scott Chacon\", \"schacon@gmail.com\", 123456789, 60);\n var committer = git.Signature.create(\"Scott A Chacon\", \"scott@github.com\", 987654321, 90);\n\n //commit\n repo.createCommit('HEAD', author, committer, 'message', oid, [parent], function(error, commitId) {\n console.log(\"New Commit:\", commitId.sha());\n });\n });\n });\n });\n });\n });\n });\n });\n });\n```\n\nIt says \"Error: Reference 'refs/heads/master' not found\".\nI can run git add/git commit manually and it will create refs/heads/master. But the code cannot.\nSo what can I do for this? Thanks very much.\n","author":{"url":"https://github.com/v11985","@type":"Person","name":"v11985"},"datePublished":"2014-08-12T02:39:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/213/nodegit/issues/213"}
| 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:cf583093-7bd2-142b-39b2-5b3b2a94700e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8EA2:1C9D94:7906AB2:A224177:6A5E1AB4 |
| html-safe-nonce | bda933d38279863ad838ba5b0b3ffcecb8512d4960bda103a981214440196206 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RUEyOjFDOUQ5NDo3OTA2QUIyOkEyMjQxNzc6NkE1RTFBQjQiLCJ2aXNpdG9yX2lkIjoiODU3ODkzNTQxMDE3Mjc2MjgwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 047bf8bb48a285400b854dbf5948de6bec362c582bbd074e371d1bbb7e85544d |
| hovercard-subject-tag | issue:40019760 |
| 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/213/issue_layout |
| twitter:image | https://opengraph.githubassets.com/49512dd726ae1b71b0901d4e7a01f57beb68574260c6e8d676bd21d196bcb7f5/nodegit/nodegit/issues/213 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/49512dd726ae1b71b0901d4e7a01f57beb68574260c6e8d676bd21d196bcb7f5/nodegit/nodegit/issues/213 |
| og:image:alt | Hi, I have init a repo with the code: git.Repo.init(resourcePath,false,function(initReporError, repo){ if (initReporError) throw initReporError; console.log("Repo init : "+repo); } Then I create co... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | v11985 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7a60e060dad2c24f72179d36247204b454da37845d1728020cd42046a433f87f |
| 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 | 0ae7f3ea7b1bb2f1f4623bb093bbf54cee05d830 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width