feat: log git error message when authentication verification fails

This commit is contained in:
pvdlg
2018-05-04 12:19:24 -07:00
committed by Gregor Martynus
parent d1c3ad0b57
commit cd9f2bdd44
3 changed files with 11 additions and 4 deletions
+3 -2
View File
@@ -86,13 +86,14 @@ async function isGitRepo() {
* @param {String} repositoryUrl The remote repository URL.
* @param {String} branch The repositoru branch for which to verify write access.
*
* @return {Boolean} `true` is authorized to push, falsy otherwise.
* @throws {Error} if not authorized to push.
*/
async function verifyAuth(repositoryUrl, branch) {
try {
return (await execa('git', ['push', '--dry-run', repositoryUrl, `HEAD:${branch}`])).code === 0;
await execa('git', ['push', '--dry-run', repositoryUrl, `HEAD:${branch}`]);
} catch (err) {
debug(err);
throw err;
}
}