{"id":13402508,"url":"https://github.com/nodegit/nodegit","last_synced_at":"2025-05-13T15:03:03.055Z","repository":{"id":37752437,"uuid":"1383170","full_name":"nodegit/nodegit","owner":"nodegit","description":"Native Node bindings to Git.","archived":false,"fork":false,"pushed_at":"2025-02-14T03:44:50.000Z","size":53316,"stargazers_count":5699,"open_issues_count":378,"forks_count":697,"subscribers_count":73,"default_branch":"master","last_synced_at":"2025-05-05T22:18:00.723Z","etag":null,"topics":["c-plus-plus","electron","git","javascript","js","libgit2","linux","macos","mit","node","nodegit","nodejs","windows"],"latest_commit_sha":null,"homepage":"https://www.nodegit.org/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nodegit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2011-02-18T16:42:46.000Z","updated_at":"2025-05-01T21:23:29.000Z","dependencies_parsed_at":"2022-07-14T08:32:12.758Z","dependency_job_id":"fba5eb34-9e00-45e7-9c0a-00d553b276bc","html_url":"https://github.com/nodegit/nodegit","commit_stats":{"total_commits":3183,"total_committers":184,"mean_commits":17.29891304347826,"dds":0.8206094879044926,"last_synced_commit":"e10267ba307e26d6ec2ea095de1d9fe5e1214cf6"},"previous_names":["tbranyen/nodegit"],"tags_count":151,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodegit%2Fnodegit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodegit%2Fnodegit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodegit%2Fnodegit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodegit%2Fnodegit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodegit","download_url":"https://codeload.github.com/nodegit/nodegit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252839283,"owners_count":21812085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","electron","git","javascript","js","libgit2","linux","macos","mit","node","nodegit","nodejs","windows"],"created_at":"2024-07-30T19:01:16.981Z","updated_at":"2025-05-13T15:03:03.004Z","avatar_url":"https://github.com/nodegit.png","language":"JavaScript","readme":"# NodeGit\n\n\u003e Node bindings to the [libgit2](http://libgit2.github.com/) project.\n\n[![Actions Status](https://github.com/nodegit/nodegit/workflows/Testing/badge.svg)](https://github.com/nodegit/nodegit/actions)\n\n**Stable (libgit2@v0.28.3): 0.28.3**\n\n## Have a problem? Come chat with us! ##\n\nVisit [slack.libgit2.org](http://slack.libgit2.org/) to sign up, then join us in #nodegit.\n\n## Maintained by ##\nTyler Ang-Wanek [@twwanek](http://twitter.com/twwanek) with help from tons of\n[awesome contributors](https://github.com/nodegit/nodegit/contributors)!\n\n### Alumni Maintainers ###\nTim Branyen [@tbranyen](http://twitter.com/tbranyen),\nJohn Haley [@johnhaley81](http://twitter.com/johnhaley81),\nMax Korp [@maxkorp](http://twitter.com/MaximilianoKorp),\nSteve Smith [@orderedlist](https://twitter.com/orderedlist),\nMichael Robinson [@codeofinterest](http://twitter.com/codeofinterest), and\nNick Kallen [@nk](http://twitter.com/nk)\n\n## API Documentation. ##\n\n[http://www.nodegit.org/](http://www.nodegit.org/)\n\n## Getting started. ##\n\nNodeGit will work on most systems out-of-the-box without any native\ndependencies.\n\n``` bash\nnpm install nodegit\n```\n\nIf you receive errors about libstdc++, which are commonly experienced when\nbuilding on Travis-CI, you can fix this by upgrading to the latest\nlibstdc++-4.9.\n\nIn Ubuntu:\n\n``` sh\nsudo add-apt-repository ppa:ubuntu-toolchain-r/test\nsudo apt-get update\nsudo apt-get install libstdc++-4.9-dev\n```\n\nIn Travis:\n\n``` yaml\naddons:\n  apt:\n    sources:\n      - ubuntu-toolchain-r-test\n    packages:\n      - libstdc++-4.9-dev\n```\n\nIn CircleCI:\n\n``` yaml\n  dependencies:\n    pre:\n      - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test\n      - sudo apt-get update\n      - sudo apt-get install -y libstdc++-4.9-dev\n```\n\nIf you receive errors about *lifecycleScripts* preinstall/install you probably miss *libssl-dev*\nIn Ubuntu:\n```\nsudo apt-get install libssl-dev\n```\n\nYou will need the following libraries installed on your linux machine:\n  - libpcre\n  - libpcreposix\n  - libkrb5\n  - libk5crypto\n  - libcom_err\n\nWhen building locally, you will also need development packages for kerberos and pcre, so both of these utilities must be present on your machine:\n  - pcre-config\n  - krb5-config\n\n\nIf you are still encountering problems while installing, you should try the\n[Building from source](http://www.nodegit.org/guides/install/from-source/)\ninstructions.\n\n## API examples. ##\n\n### Cloning a repository and reading a file: ###\n\n``` javascript\nvar Git = require(\"nodegit\");\n\n// Clone a given repository into the `./tmp` folder.\nGit.Clone(\"https://github.com/nodegit/nodegit\", \"./tmp\")\n  // Look up this known commit.\n  .then(function(repo) {\n    // Use a known commit sha from this repository.\n    return repo.getCommit(\"59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5\");\n  })\n  // Look up a specific file within that commit.\n  .then(function(commit) {\n    return commit.getEntry(\"README.md\");\n  })\n  // Get the blob contents from the file.\n  .then(function(entry) {\n    // Patch the blob to contain a reference to the entry.\n    return entry.getBlob().then(function(blob) {\n      blob.entry = entry;\n      return blob;\n    });\n  })\n  // Display information about the blob.\n  .then(function(blob) {\n    // Show the path, sha, and filesize in bytes.\n    console.log(blob.entry.path() + blob.entry.sha() + blob.rawsize() + \"b\");\n\n    // Show a spacer.\n    console.log(Array(72).join(\"=\") + \"\\n\\n\");\n\n    // Show the entire file.\n    console.log(String(blob));\n  })\n  .catch(function(err) { console.log(err); });\n\n```\n\n### Emulating git log: ###\n\n``` javascript\nvar Git = require(\"nodegit\");\n\n// Open the repository directory.\nGit.Repository.open(\"tmp\")\n  // Open the master branch.\n  .then(function(repo) {\n    return repo.getMasterCommit();\n  })\n  // Display information about commits on master.\n  .then(function(firstCommitOnMaster) {\n    // Create a new history event emitter.\n    var history = firstCommitOnMaster.history();\n\n    // Create a counter to only show up to 9 entries.\n    var count = 0;\n\n    // Listen for commit events from the history.\n    history.on(\"commit\", function(commit) {\n      // Disregard commits past 9.\n      if (++count \u003e= 9) {\n        return;\n      }\n\n      // Show the commit sha.\n      console.log(\"commit \" + commit.sha());\n\n      // Store the author object.\n      var author = commit.author();\n\n      // Display author information.\n      console.log(\"Author:\\t\" + author.name() + \" \u003c\" + author.email() + \"\u003e\");\n\n      // Show the commit date.\n      console.log(\"Date:\\t\" + commit.date());\n\n      // Give some space and show the message.\n      console.log(\"\\n    \" + commit.message());\n    });\n\n    // Start emitting events.\n    history.start();\n  });\n```\n\nFor more examples, check the `examples/` folder.\n\n## Unit tests. ##\n\nYou will need to build locally before running the tests.  See above.\n\n``` bash\nnpm test\n```\n","funding_links":[],"categories":["JavaScript","Packages","Repository","包","目录","Miscellaneous","[Node.js](https://github.com/nodejs/node)","Uncategorized","Number","Git"],"sub_categories":["Miscellaneous","Git","其他","Uncategorized","Torrent","杂项"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodegit%2Fnodegit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodegit%2Fnodegit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodegit%2Fnodegit/lists"}