From 52332d994e2944c72f9d49296932d98b5cbfe68c Mon Sep 17 00:00:00 2001 From: Stephan Vock Date: Fri, 19 Jun 2020 10:24:40 +0100 Subject: [PATCH] GitDriver: use authentication for supports check --- src/Composer/Repository/Vcs/GitDriver.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Composer/Repository/Vcs/GitDriver.php b/src/Composer/Repository/Vcs/GitDriver.php index cc6e3edb4..8c6902298 100644 --- a/src/Composer/Repository/Vcs/GitDriver.php +++ b/src/Composer/Repository/Vcs/GitDriver.php @@ -219,8 +219,17 @@ class GitDriver extends VcsDriver return false; } - $process = new ProcessExecutor($io); + $gitUtil = new GitUtil($io, $config, new ProcessExecutor($io), new Filesystem()); + GitUtil::cleanEnv(); - return $process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0; + try { + $gitUtil->runCommand(function ($url) { + return 'git ls-remote --heads ' . ProcessExecutor::escape($url); + }, $url, sys_get_temp_dir()); + } catch (\RuntimeException $e) { + return false; + } + + return true; } }