我正在使用Composer 1.2.0和以下文件:
composer.json
{
"repositories": [
{
"type": "composer",
"url": "https://composer.typo3.org/"
},
{
"type": "vcs",
"url": "https://sub.domain.com/git/xyz"
}
],
"require": {
"typo3/cms": "^7.6.10",
"vendor/extension": "dev-develop"
},
"extra": {
"typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms",
"web-dir": "web"
}
}
}
auth.json
{
"http-basic": {
"sub.domain.com": {
"username": "user",
"password": "password"
}
}
}
当我执行$ composer install -vvv
或$ composer update -vvv
时,我得到:
Reading ./composer.json
Loading config file /home/user/.composer/config.json
Loading config file /home/user/.composer/auth.json
Loading config file ./composer.json
Loading config file /var/www/html/auth.json
Reading /var/www/html/auth.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/var/www/html): git branch --no-color --no-abbrev -v
Executing command (/var/www/html): git describe --exact-match --tags
Executing command (/var/www/html): git log --pretty="%H" -n1 HEAD
Reading /home/user/.composer/composer.json
Loading config file /home/user/.composer/config.json
Loading config file /home/user/.composer/auth.json
Loading config file /home/user/.composer/composer.json
Loading config file /home/user/.composer/auth.json
Reading /home/user/.composer/auth.json
Reading /var/www/html/vendor/composer/installed.json
Reading /home/user/.composer/vendor/composer/installed.json
Loading plugin TYPO3CMSComposerInstallerPlugin
Loading plugin TYPO3ClassAliasLoaderPlugin
Loading composer repositories with package information
Downloading https://composer.typo3.org/packages.json
Writing /home/user/.composer/cache/repo/https---composer.typo3.org/packages.json into cache
Reading /home/user/.composer/cache/repo/https---composer.typo3.org/include-all$696fe823dea214c8bc4ec4550c84cd3a4aae245b.json from cache
Executing command (CWD): git ls-remote --heads 'https://sub.domain.com/git/xyz'
Executing command (CWD): p4 -p https://sub.domain.com/git/xyz info -s
[InvalidArgumentException]
No driver found to handle VCS repository https://sub.domain.com/git/xyz
Exception trace:
() at phar:///usr/local/bin/composer/src/Composer/Repository/VcsRepository.php:125
ComposerRepositoryVcsRepository->initialize() at phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:185
ComposerRepositoryArrayRepository->getPackages() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:104
ComposerDependencyResolverPool->addRepository() at phar:///usr/local/bin/composer/src/Composer/Installer.php:365
ComposerInstaller->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:216
ComposerInstaller->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:174
ComposerCommandUpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:259
SymfonyComponentConsoleCommandCommand->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:844
SymfonyComponentConsoleApplication->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:192
SymfonyComponentConsoleApplication->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:231
ComposerConsoleApplication->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:123
SymfonyComponentConsoleApplication->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:104
ComposerConsoleApplication->run() at phar:///usr/local/bin/composer/bin/composer:43
require() at /usr/local/bin/composer:24
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...
但当我在composer.json
中使用https://user:password@sub.domain.com/git/xyz
而不是https://sub.domain.com/git/xyz
时,一切都很好。可能是什么问题?
这里有两个问题:
- 有一个错误
- URL没有
.git
后缀
对于第二个问题,有一个很好的解释:
[..]URL不能被后缀
.git
]检测到,因此它将依赖于完整的检测,这涉及到运行git ls-remote --heads <url>
。但在您的情况下,由于缺少凭据,这确实会失败,因此检测不会将其检测为git repo。
要解决第二个问题,只需使用git
而不是vcs
作为存储库类型。
另请参阅https://github.com/composer/composer/issues/5543.