From 438f1485fa09200a2e9daa504c29e94be8f00326 Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 27 Apr 2019 00:08:43 -0400 Subject: [PATCH] fix: handle git basic auth URl format (#814) --- server/modules/storage/git/storage.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/modules/storage/git/storage.js b/server/modules/storage/git/storage.js index bcc6195f..db1380ae 100644 --- a/server/modules/storage/git/storage.js +++ b/server/modules/storage/git/storage.js @@ -109,8 +109,14 @@ module.exports = { await this.git.addRemote('origin', this.config.repoUrl) break default: - WIKI.logger.info('(STORAGE/GIT) Adding origin remote via HTTPS...') - await this.git.addRemote('origin', `https://${this.config.basicUsername}:${this.config.basicPassword}@${this.config.repoUrl}`) + WIKI.logger.info('(STORAGE/GIT) Adding origin remote via HTTP/S...') + let originUrl = '' + if (_.startsWith(this.config.repoUrl, 'http')) { + originUrl = originUrl.replace('://', `://${this.config.basicUsername}:${this.config.basicPassword}@`) + } else { + originUrl = `https://${this.config.basicUsername}:${this.config.basicPassword}@${this.config.repoUrl}` + } + await this.git.addRemote('origin', ) break }