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
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 streamreturns
{Stream}: if not callback
given as last argument - a Spawn stream
Example
const gitclone = require('gitclone')
gitclone('node-minibase/minibase', true)
gitclone('node-minibase/minibase', (err) => {
if (err) return console.error(err)
})
gitclone('verbose/verb#dev', console.log)
gitclone('jonchlinkert', 'nanomatch', true)
gitclone('hybridables/always-done', { dest: 'foobar' })
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.
