From 65880e39e0d3c596847cf06b12e3d9fe1c7cb9ec Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Wed, 13 Feb 2019 08:47:37 -0500
Subject: [PATCH] fix(gitFs): catch and throw bad-credentials

---
 lib/workers/branch/index.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/workers/branch/index.js b/lib/workers/branch/index.js
index 8c65e35ecf..98da4e15bc 100644
--- a/lib/workers/branch/index.js
+++ b/lib/workers/branch/index.js
@@ -299,6 +299,13 @@ async function processBranch(branchConfig, prHourlyLimitReached, packageFiles) {
       logger.debug('Passing repository-changed error up');
       throw err;
     }
+    if (
+      err.message &&
+      err.message.startsWith('remote: Invalid username or password')
+    ) {
+      logger.debug('Throwing bad credentials');
+      throw new Error('bad-credentials');
+    }
     if (err.message === 'bad-credentials') {
       logger.debug('Passing bad-credentials error up');
       throw err;
-- 
GitLab