From 642bcac472fb7e743fe8f3eda8c16fc93680107b Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sun, 16 Apr 2017 12:15:09 -0400 Subject: [PATCH] Set git remote on init --- libs/git.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/git.js b/libs/git.js index c519aae7..3e172a63 100644 --- a/libs/git.js +++ b/libs/git.js @@ -115,15 +115,15 @@ module.exports = { return self._git.exec('remote', 'show').then((cProc) => { let out = cProc.stdout.toString() - if (_.includes(out, 'origin')) { - return true - } else { - return Promise.each(gitConfigs, fn => { return fn() }).then(() => { + return Promise.each(gitConfigs, fn => { return fn() }).then(() => { + if (!_.includes(out, 'origin')) { return self._git.exec('remote', ['add', 'origin', self._url]) - }).catch(err => { - winston.error(err) - }) - } + } else { + return self._git.exec('remote', ['set-url', 'origin', self._url]) + } + }).catch(err => { + winston.error(err) + }) }) }).catch((err) => { winston.error('[' + PROCNAME + '.Git] Git remote error!')