gitclone

Clone a Github repository programmatically. Hybrid, Async and Promise API

MIT License

Downloads
62
Stars
6
Committers
2

gitclone npmjs.com The MIT License npm downloads

Powerful and flexible programmatic interface for the git clone command, using gitclone-defaults and cross-spawn

Install

Install with npm

$ npm i gitclone --save

Usage

For more use-cases see the tests

const gitclone = require('gitclone')

API

gitclone

Clones github repository, optionally pass destination folder. By defaults uses HTTPS to clone the repository. If you want SSH clone you should pass second, third or fourth argument boolean true, or object {ssh: true}. Pattern can be user/repo#branch as first argument. Or first argument user, second argument repo, third branch, fourth ssh.

Hint: All arguments are super flexible and they are handled absolutely directly with gitclone-defaults, so read its API docs. In addition, you also can pass callback as last argument, otherwise it will return Spawn stream.

Params

  • [callback] {Function}: optional, if not given, returns a stream
  • returns {Stream}: if not callback given as last argument - a Spawn stream

Example

const gitclone = require('gitclone')

// clones with SSH
gitclone('node-minibase/minibase', true)

// clone with HTTPS
gitclone('node-minibase/minibase', (err) => {
  if (err) return console.error(err)
})

// clone `dev` branch from `verbose/verb` repo
gitclone('verbose/verb#dev', console.log)

// clone `jonschlinkert/nanomatch` with SSH
gitclone('jonchlinkert', 'nanomatch', true)

// clone to different destination folder
gitclone('hybridables/always-done', { dest: 'foobar' })

// clone SSH + dest + branch
gitclone('verbose/verb', { dest: 'verb0.9.0', branch: 'dev', ssh: true })

Related

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. But before doing anything, please read the CONTRIBUTING.md guidelines.

Charlike Make Reagent new message to charlike freenode #charlike

Package Rankings
Top 9.76% on Npmjs.org
Badges
Extracted from project README
npmjs.com The MIT License npm downloads code climate standard code style travis build status coverage status dependency status new message to charlike freenode #charlike tunnckoCore.tk keybase tunnckoCore tunnckoCore npm tunnckoCore twitter tunnckoCore github
Related Projects