diff --git a/src/Composer/Downloader/GitDownloader.php b/src/Composer/Downloader/GitDownloader.php index a529a9635..50311b2bf 100644 --- a/src/Composer/Downloader/GitDownloader.php +++ b/src/Composer/Downloader/GitDownloader.php @@ -129,9 +129,16 @@ class GitDownloader extends VcsDownloader if (0 === $this->process->execute($command, $handler)) { return; } + if (null !== $path) { + $this->filesystem->removeDirectory($path); + } $retrying = true; } while (--$retries); } + + if (null !== $path) { + $this->filesystem->removeDirectory($path); + } $this->throwException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(), $url); } } diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php index f1e507235..9b8974c8c 100644 --- a/src/Composer/Repository/Vcs/GitHubDriver.php +++ b/src/Composer/Repository/Vcs/GitHubDriver.php @@ -43,7 +43,7 @@ class GitHubDriver extends VcsDriver */ public function initialize() { - preg_match('#^(?:https?|git)://github\.com/([^/]+)/(.+?)(?:\.git)?$#', $this->url, $match); + preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $this->url, $match); $this->owner = $match[1]; $this->repository = $match[2]; $this->originUrl = 'github.com'; @@ -177,7 +177,7 @@ class GitHubDriver extends VcsDriver */ public static function supports(IOInterface $io, $url, $deep = false) { - if (!preg_match('#^(?:https?|git)://github\.com/([^/]+)/(.+?)(?:\.git)?$#', $url)) { + if (!preg_match('#^((?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url)) { return false; }