1
0
Fork 0

Avoid overwriting credentials with existing ones from git repos, refs #8293

pull/8401/head
Jordi Boggiano 2019-10-30 12:56:08 +01:00
parent 12184aa9c5
commit 4e43f849c7
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 2 additions and 2 deletions

View File

@ -54,9 +54,9 @@ class Git
}
if (!$initialClone) {
// capture username/password from URL if there is one
// capture username/password from URL if there is one and we have no auth configured yet
$this->process->execute('git remote -v', $output, $cwd);
if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match) && !$this->io->hasAuthentication($match[3])) {
$this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
}
}