diff --git a/lib/cli.js b/lib/cli.js index 37bb0c6..87af095 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -41,6 +41,10 @@ cli.config = function(name, options) { } else { + + if (!git.config("gerrit.default-remote")) { + git.config("gerrit.default-remote", "origin", {local: true}); + } name = name || "default"; diff --git a/lib/gerrit.js b/lib/gerrit.js index 61d3bfa..11d8c9b 100644 --- a/lib/gerrit.js +++ b/lib/gerrit.js @@ -22,7 +22,12 @@ gerrit.GerritError = GerritError; gerrit.parseRemote = function(remote) { - remote = remote || "origin"; + var defaultRemote = git.config("gerrit.default-remote", {local: true}); + if (!defaultRemote) { + defaultRemote = "origin"; + git.config("gerrit.default-remote", defaultRemote, {local: true}); + } + remote = remote || defaultRemote || "origin"; return requireInRepo() .then(function() {