diff --git a/src/Composer/Util/Git.php b/src/Composer/Util/Git.php
index 74e5c286f..20457d708 100644
--- a/src/Composer/Util/Git.php
+++ b/src/Composer/Util/Git.php
@@ -193,7 +193,7 @@ class Git
}
}
- $this->io->writeError(' Authentication required (' . parse_url($url, PHP_URL_HOST) . '):');
+ $this->io->writeError(' Authentication required (' . $match[2] . '):');
$auth = array(
'username' => $this->io->ask(' Username: ', $defaultUsername),
'password' => $this->io->askAndHideAnswer(' Password: '),
diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php
index a44d8f86f..b3f51aae5 100644
--- a/src/Composer/Util/RemoteFilesystem.php
+++ b/src/Composer/Util/RemoteFilesystem.php
@@ -745,7 +745,7 @@ class RemoteFilesystem
throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
}
- $this->io->writeError(' Authentication required ('.parse_url($this->fileUrl, PHP_URL_HOST).'):');
+ $this->io->writeError(' Authentication required ('.$this->originUrl.'):');
$username = $this->io->ask(' Username: ');
$password = $this->io->askAndHideAnswer(' Password: ');
$this->io->setAuthentication($this->originUrl, $username, $password);