{"id":17323935,"url":"https://github.com/strugee/node-git-clone-or-pull","last_synced_at":"2025-06-11T10:07:24.705Z","repository":{"id":142464517,"uuid":"63316635","full_name":"strugee/node-git-clone-or-pull","owner":"strugee","description":"Ensure a git repo exists on disk and that it's up-to-date","archived":false,"fork":false,"pushed_at":"2020-09-02T21:58:17.000Z","size":410,"stargazers_count":4,"open_issues_count":7,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T22:08:57.231Z","etag":null,"topics":["git","hacktoberfest","javascript","nodegit","nodejs","npm-package","small-modules"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/strugee.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2016-07-14T08:16:16.000Z","updated_at":"2021-10-07T17:22:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"40b3f6f4-3f5e-42cc-b765-eb9a9d57fa51","html_url":"https://github.com/strugee/node-git-clone-or-pull","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strugee%2Fnode-git-clone-or-pull","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strugee%2Fnode-git-clone-or-pull/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strugee%2Fnode-git-clone-or-pull/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strugee%2Fnode-git-clone-or-pull/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strugee","download_url":"https://codeload.github.com/strugee/node-git-clone-or-pull/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154984,"owners_count":21056543,"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":["git","hacktoberfest","javascript","nodegit","nodejs","npm-package","small-modules"],"created_at":"2024-10-15T14:09:38.356Z","updated_at":"2025-04-14T16:42:09.629Z","avatar_url":"https://github.com/strugee.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `git-clone-or-pull`\n\n[![Build Status](https://travis-ci.org/strugee/node-git-clone-or-pull.svg?branch=master)](http://travis-ci.org/strugee/node-git-clone-or-pull)\n[![Coverage Status](https://coveralls.io/repos/github/strugee/node-git-clone-or-pull/badge.svg?branch=master)](https://coveralls.io/github/strugee/node-git-clone-or-pull?branch=master)\n[![npm](https://img.shields.io/npm/v/git-clone-or-pull.svg)](https://npmjs.com/package/git-clone-or-pull)\n[![Greenkeeper badge](https://badges.greenkeeper.io/strugee/node-git-clone-or-pull.svg)](https://greenkeeper.io/)\n\nEnsure a git repo exists on disk and that it's up-to-date\n\n## Installation\n\n    npm install git-clone-or-pull\n\nNode 4.x or greater is required. The module will probably work on Node 0.12, but the tests do not. So I wouldn't count on it.\n\n## Usage\n\nSimple example:\n\n```js\nvar cloneOrPull = require('git-clone-or-pull');\nvar path = require('path');\n\ncloneOrPull('git://github.com/strugee/node-git-clone-or-pull.git', path.join(process.cwd(), 'node-git-clone-or-pull'), function(err) {\n    if (err) throw err;\n\n    // Use repo\n});\n```\n\nThe `cloneOrPull()` function takes three arguments. In order:\n\n`url` (`String`) - the URL to clone from\n\n`opts` (`String` or `Object`) the pathname to clone to if a `String`, otherwise an object containing module options (see \"Options\" below)\n\n`callback` (`Function`) function callback that will be called upon completion of the clone or pull. If there is an error, it will be passed as the first argument.\n\n## Options\n\n`path` (`String`) - the pathname to clone to. If a `String` is provided instead of an options `Object`, it will be used as `path`'s value.\n\n`implementation` (`String`) - the implementation to use; defaults to `nodegit` in most cases (see \"Implementations\" below)\n\n`branch` (`String`) - the branch to use; defaults to `master` (even if the default upstream branch is something else)\n\n## Implementations\n\n* `nodegit` uses NodeGit, the libgit2 bindings for Node.\n* `subprocess` is based on spawning `git` subprocesses (which means you need a `git` binary installed).\n\nImplementation is determined with the following algorithm:\n\n1. If `opts.implementation` exists its value will be used as the implementation; if that implementation is unavailable an error will be returned to the callback\n2. If NodeGit can be loaded, the implementation will be `nodegit`\n3. If `git --version` returns an exit code of 0, the implementation will be `subprocess`\n4. No implementation can be found and an error will be returned to the callback\n\nEach implementation has its negatives: `nodegit` makes installation slightly more complicated. `subprocess` works on most systems - but it requires an external binary.\n\n## License\n\nLGPL 3.0+\n\n## Author\n\nAJ Jordan \u003calex@strugee.net\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrugee%2Fnode-git-clone-or-pull","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrugee%2Fnode-git-clone-or-pull","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrugee%2Fnode-git-clone-or-pull/lists"}