Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. GitDownloader.php

function GitDownloader::setPushUrl

2 calls to GitDownloader::setPushUrl()
GitDownloader::doInstall in vendor/composer/composer/src/Composer/Downloader/GitDownloader.php
@inheritDoc
GitDownloader::updateOriginUrl in vendor/composer/composer/src/Composer/Downloader/GitDownloader.php

File

vendor/composer/composer/src/Composer/Downloader/GitDownloader.php, line 518

Class

GitDownloader
@author Jordi Boggiano <j.boggiano@seld.be>

Namespace

Composer\Downloader

Code

protected function setPushUrl(string $path, string $url) : void {
    // set push url for github projects
    if (Preg::isMatch('{^(?:https?|git)://' . GitUtil::getGitHubDomainsRegex($this->config) . '/([^/]+)/([^/]+?)(?:\\.git)?$}', $url, $match)) {
        $protocols = $this->config
            ->get('github-protocols');
        $pushUrl = 'git@' . $match[1] . ':' . $match[2] . '/' . $match[3] . '.git';
        if (!in_array('ssh', $protocols, true)) {
            $pushUrl = 'https://' . $match[1] . '/' . $match[2] . '/' . $match[3] . '.git';
        }
        $cmd = [
            'git',
            'remote',
            'set-url',
            '--push',
            'origin',
            '--',
            $pushUrl,
        ];
        $this->process
            ->execute($cmd, $ignoredOutput, $path);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal