Git.clone()

Clone a remote git repository into a new local directory.

Usage

Hover over inputs/exits for more info.

var Git = require('machinepack-git');


// Clone a remote git repository into a new local directory.

Git.clone({

destination: './put/the/new/local/repo/here',

remote: 'git://github.com/balderdashy/sails-docs.git',

branch: 'master',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// Insufficient permissions at destination path to clone repo repo.

forbidden: function () {

 

},

// Somthing other than an empty directory already exists at the destination path.

alreadyExists: function () {

 

},

// OK.

success: function () {

 

},

});

Inputs

destination required

Path (relative or absolute) to the directory where the repo should be cloned. Will be created if necessary.

'./put/the/new/local/repo/here'
remote required

The URL of the git remote repository that will be cloned.

'git://github.com/balderdashy/sails-docs.git'
branch

The remote branch to check out after pulling (if omitted, do not check out anything-- just use whatever the default is)

'master'

Exits

error

An unexpected error occurred.

forbidden

Insufficient permissions at destination path to clone repo repo.

alreadyExists

Somthing other than an empty directory already exists at the destination path.

success

OK.