# git-pull-or-clone

> Ensure a git repo exists on disk and that it's up-to-date

Latest version **2.0.2** (published 2022-04-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install git-pull-or-clone
pnpm add git-pull-or-clone
yarn add git-pull-or-clone
bun add git-pull-or-clone
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2022-04-06 |
| First published | 2017-04-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 2 |
| Unpacked size | 8.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Feross Aboukhadijeh |
| Maintainers | feross |
| Keywords | clone, git, git clone, git pull, git pull or clone, git sync, pull, pull or clone, sync |

## Links

- npm: https://www.npmjs.com/package/git-pull-or-clone
- Repository: https://github.com/feross/git-pull-or-clone
- Homepage: https://github.com/feross/git-pull-or-clone#readme
- Issues: https://github.com/feross/git-pull-or-clone/issues
- Funding: https://github.com/sponsors/feross
- npm.io page: https://npm.io/package/git-pull-or-clone

## Dependencies (2)

- [debug](https://npm.io/package/debug.md) ^4.1.1
- [cross-spawn](https://npm.io/package/cross-spawn.md) ^7.0.0

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 2.0.2 (latest) — 2022-04-06
- 2.0.1 — 2020-05-10
- 2.0.0 — 2019-09-04
- 1.3.0 — 2019-08-04
- 1.2.0 — 2018-03-02
- 1.1.0 — 2017-06-16
- 1.0.0 — 2017-04-28

## README

# git-pull-or-clone [![ci][ci-image]][ci-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url]

[ci-image]: https://img.shields.io/github/workflow/status/feross/git-pull-or-clone/ci/master
[ci-url]: https://github.com/feross/git-pull-or-clone/actions
[npm-image]: https://img.shields.io/npm/v/git-pull-or-clone.svg
[npm-url]: https://npmjs.org/package/git-pull-or-clone
[downloads-image]: https://img.shields.io/npm/dm/git-pull-or-clone.svg
[downloads-url]: https://npmjs.org/package/git-pull-or-clone

### Ensure a git repo exists on disk and that it's up-to-date

## Install

```
npm install git-pull-or-clone
```

## Usage

```js
const gitPullOrClone = require('git-pull-or-clone')

gitPullOrClone('git@github.com:feross/standard.git', '/path/to/destination', (err) => {
  if (err) throw err
  console.log('SUCCESS!')
})
```

## API

### `gitPullOrClone(url, outPath[, options], callback)`

Ensure a git repo exists on disk and that it's up-to-date.

Clones the git repo specified by `url` to the path `outPath`. If the repo already exists on disk,
then a pull is performed to update the repo instead.

The git repo is shallowly cloned by default. To make a complete clone, set `options.depth` to `Infinity`. If the git repo was previously cloned shallowly, it remains shallow.

When the operation is finished, `callback` is called. The first argument to `callback` is either
`null` or an `Error` object if an error occurred.

## License

MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).

---
_Source: https://npm.io/package/git-pull-or-clone · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
