diff --git a/lib/util/git/index.ts b/lib/util/git/index.ts index e06e53fe9105c4026082185bab36bf3b287129c9..5e03779ec0412071587461b711e7d130b49f7ac2 100644 --- a/lib/util/git/index.ts +++ b/lib/util/git/index.ts @@ -713,6 +713,13 @@ export async function commitFiles({ ); return null; } + if (err.message.includes('protected branch hook declined')) { + const error = new Error(CONFIG_VALIDATION); + error.configFile = branchName; + error.validationError = 'Renovate branch is protected'; + error.validationMessage = `Renovate cannot push to its branch because branch protection has been enabled.`; + throw error; + } if (err.message.includes('remote: error: cannot lock ref')) { logger.error({ err }, 'Error committing files.'); return null;