当我尝试从私有存储库安装依赖项时,出现以下错误:
> 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:[email protected]/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
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句