1
0
Fork 0

Merge branch '1.1'

pull/5277/merge
Jordi Boggiano 2016-05-04 10:35:00 +01:00
commit 6620136309
1 changed files with 8 additions and 1 deletions

View File

@ -112,7 +112,7 @@ class Git
return; return;
} }
} }
} elseif (preg_match('{^https://(bitbucket.org)/(.*)}', $url, $match)) { //bitbucket oauth } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) { //bitbucket oauth
$bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process); $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
if (!$this->io->hasAuthentication($match[1])) { if (!$this->io->hasAuthentication($match[1])) {
@ -141,6 +141,13 @@ class Git
if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) { if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
return; return;
} }
} else { // Falling back to ssh
$sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
$this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
$command = call_user_func($commandCallable, $sshUrl);
if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
return;
}
} }
} elseif ($this->isAuthenticationFailure($url, $match)) { // private non-github repo that failed to authenticate } elseif ($this->isAuthenticationFailure($url, $match)) { // private non-github repo that failed to authenticate
if (strpos($match[2], '@')) { if (strpos($match[2], '@')) {