Fix github auth to try https with pwd also, fixes #8356
parent
b925d06861
commit
12184aa9c5
|
@ -95,8 +95,10 @@ class Git
|
||||||
|
|
||||||
$auth = null;
|
$auth = null;
|
||||||
if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
|
if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
|
||||||
// private github repository without git access, try https with auth
|
// private github repository without ssh key access, try https with auth
|
||||||
if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)) {
|
if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)
|
||||||
|
|| preg_match('{^(https?)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)
|
||||||
|
) {
|
||||||
if (!$this->io->hasAuthentication($match[1])) {
|
if (!$this->io->hasAuthentication($match[1])) {
|
||||||
$gitHubUtil = new GitHub($this->io, $this->config, $this->process);
|
$gitHubUtil = new GitHub($this->io, $this->config, $this->process);
|
||||||
$message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
|
$message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
|
||||||
|
@ -183,7 +185,7 @@ class Git
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($this->isAuthenticationFailure($url, $match)) { // private non-github repo that failed to authenticate
|
} elseif ($this->isAuthenticationFailure($url, $match)) { // private non-github/gitlab/bitbucket repo that failed to authenticate
|
||||||
if (strpos($match[2], '@')) {
|
if (strpos($match[2], '@')) {
|
||||||
list($authParts, $match[2]) = explode('@', $match[2], 2);
|
list($authParts, $match[2]) = explode('@', $match[2], 2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue