1
0
Fork 0
pull/3909/head
Frederik Bosch 2015-04-04 12:34:51 +02:00
parent f10c714751
commit 951b07eabc
1 changed files with 16 additions and 2 deletions

View File

@ -106,8 +106,7 @@ class Git
}
}
} elseif ( // private non-github repo that failed to authenticate
preg_match('{(https?://)([^/]+)(.*)$}i', $url, $match) &&
strpos($this->process->getErrorOutput(), 'fatal: Authentication failed') !== false
$this->isAuthenticationFailure($url, $match)
) {
if (strpos($match[2], '@')) {
list($authParts, $match[2]) = explode('@', $match[2], 2);
@ -155,6 +154,21 @@ class Git
}
}
private function isAuthenticationFailure ($url, &$match) {
if (!preg_match('{(https?://)([^/]+)(.*)$}i', $url, $match)) {
return false;
}
$authFailures = array('fatal: Authentication failed', 'remote error: Invalid username or password.');
foreach ($authFailures as $authFailure) {
if (strpos($this->process->getErrorOutput(), $authFailure) !== false) {
return true;
}
}
return false;
}
public static function cleanEnv()
{
if (ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {