diff --git a/lib/git.js b/lib/git.js index af3c8b7..414e0bd 100644 --- a/lib/git.js +++ b/lib/git.js @@ -99,13 +99,14 @@ exports.clone = function clone(repo, dir, branch, options) { return Q.resolve(); } else { return fs.makeTree(path.dirname(path.resolve(dir))).then(function() { - var args = ['clone', repo, dir, '--branch', branch, '--single-branch']; + var args = ['clone', repo, dir, '--branch', branch, '--single-branch', + '--origin', options.remote]; if (options.depth) { args.push('--depth', options.depth); } return spawn(git, args).fail(function(err) { // try again without banch options - return spawn(git, ['clone', repo, dir]); + return spawn(git, ['clone', repo, dir, '--origin', options.remote]); }); }); } diff --git a/lib/index.js b/lib/index.js index d6a0a00..024191a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -29,9 +29,9 @@ function getRemoteUrl(dir, remote) { }) .fail(function(err) { return Q.reject(new Error( - 'Failed to get remote.' + remote + '.url (task must either be run in a ' + - 'git repository with a configured ' + remote + ' remote or must be ' + - 'configured with the "repo" option).')); + 'Failed to get remote.' + remote + '.url (task must either be ' + + 'run in a git repository with a configured ' + remote + ' remote ' + + 'or must be configured with the "repo" option).')); }); }