diff --git a/src/Composer/Util/Git.php b/src/Composer/Util/Git.php index aa1f8dcb1..f752f9597 100644 --- a/src/Composer/Util/Git.php +++ b/src/Composer/Util/Git.php @@ -261,7 +261,7 @@ class Git $commandCallable = function ($url) { $sanitizedUrl = preg_replace('{://([^@]+?):(.+?)@}', '://', $url); - return sprintf('git remote set-url origin %s && git remote update --prune origin && git remote set-url origin %s', ProcessExecutor::escape($url), ProcessExecutor::escape($sanitizedUrl)); + return sprintf('git remote set-url origin %s && git remote update --prune origin && git remote set-url origin %s && git gc --auto', ProcessExecutor::escape($url), ProcessExecutor::escape($sanitizedUrl)); }; $this->runCommand($commandCallable, $url, $dir); } catch (\Exception $e) {