当我尝试从我的私有存储库安装依赖项时,我收到以下错误:
> php.exe composer.phar update
Loading composer repositories with package information
[RuntimeException]
Failed to clone https://my.stash.repo/scm/lib/my-super-lib.git, could no
t read packages from it
fatal: Authentication failed for 'https://my.stash.repo/scm/lib/my-super-lib.git/'
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]
Process finished with exit code 1 at 10:57:04.
Execution time: 1 996 ms.
相关composer.json
部分如下所示:
"require": {
"php": ">=5.3.0",
"scaytrase/my-super-lib": "1.1"
},
"repositories": [
{
"type": "vcs",
"url": "https://my.stash.repo/scm/lib/my-super-lib.git"
}
],
如果我直接设置用户名和密码
"url": "https://username:password@my.stash.repo/scm/lib/my-super-lib.git"
作曲家操作工作得很好。但我不想存储明文凭据。
有没有办法让作曲家每次都询问用户名和密码?
存储库是 Atlassian Stash,前面有 https nginx(https 和 http 都经过测试)
Composer version 70a20ebcc19f1ea8ab0954a4fbdce208b30085e7 2014-03-12 16:07:58
编辑:
现在我git clone --mirror
自己执行以填充作曲家的缓存,然后像往常一样运行作曲家安装或作曲家更新(但它说它有时无法更新包信息)
代码:
$command = sprintf('git clone --mirror %s %s', escapeshellarg($this->url), escapeshellarg($this->repoDir));
if (0 !== $this->process->execute($command, $output)) {
$output = $this->process->getErrorOutput();
if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
throw new \RuntimeException('Failed to clone '.$this->url.', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
}
throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it' . "\n\n" .$output);
}
手册git clone --mirror
工作得很好,并要求我提供凭据。但是作曲家(显然执行相同的命令) - 它没有。
编辑2
这似乎是我正在使用的 PHP Storm 8 EAP 问题。最新的稳定版本需要在 期间正确进行身份验证composer install
,但在composer update
.