如何提供对Composer使用的git存储库的访问 [英] How to provide access to a git repository that is used by Composer

查看:226
本文介绍了如何提供对Composer使用的git存储库的访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:解决方案在这里,如何使用Composer使用私有存储库

UPDATE: The solution is here, How to use private repositories with Composer

要管理我的库,我使用Composer,所以我设置依赖关系在 composer.json ,然后添加代码所在的私有存储库的远程地址( composer.json )。

To manage my libraries I use Composer, so I set the dependencies in composer.json and then add (ever in composer.json) the remote addresses of the private repositories where the code resides.

当运行 composer update / install 时,系统提示您向这些私有存储库提供访问密钥的请求。

When running composer update/install I'm prompted with a request for the access keys to those private repository.

现在,我试图将一个Symfony 2应用程序部署到Heroku。

Now, I'm trying to deploy a Symfony 2 app to Heroku.

当Heroku出现问题时尝试从我的私有存储库下载软件包:如何提供Heroku访问这些存储库?

下面是一个示例composer.json配置: / p>

Here is a sample composer.json configuration:

"require": {
    "my/private-package": "~1.0",
},
"repositories": [
    {
        "type": "git",
        "url": "https://Aerendir@bitbucket.org/Aerendir/private-package"
    }
]

此配置在Composer文档中解释(它也没有Satis,除了Heroku的问题:)或其他云托管我认为)。

This configuration is explained in the Composer Documentation (it works also without Satis, except for the "problem" with Heroku :) - or other cloud hosting I think).

有关于验证,是解释:


请注意,如果您的私人软件包托管在GitHub上,您的服务器
应该有一个ssh密钥,对于这些包,
那么你应该添加--no-interaction(或-n)标志到命令
,以确保它回到ssh密钥身份验证,而不是
提示一个密码这也是连续的
集成服务器的一个很好的技巧。

Note that if your private packages are hosted on GitHub, your server should have an ssh key that gives it access to those packages, and then you should add the --no-interaction (or -n) flag to the command to make sure it falls back to ssh key authentication instead of prompting for a password. This is also a good trick for continuous integration servers.

现在,问题是2:


  1. BitBucket有部署密钥,但是我也可以设置SSH关键

  2. 什么
    关于 Heroku SSH密钥

  1. BitBucket has deployment keys but I can also set a SSH key.
  2. What about Heroku SSH keys?

那么,我怎么能给Heroku访问在BitBucket上的私有存储库?
如何从Heroku部署的 composer install 命令下载BitBucket托管的私有存储库?

So, how can i give to Heroku access to my private repositories on BitBucket? How can I download private repositories hosted on BitBucket from the composer install command that Heroku does on deploying?

推荐答案

解决/规避了使用Composer给我的Heroku的这个限制在私人BitBucket存储库中安装依赖关系:

Resolved/circumvented this limitation of Heroku of using Composer to install dependencies in private BitBucket repositories by:

更改:

git@bitbucket.org:username/repository.git

在我的composer.json中:

in my composer.json to:

https://bitbucket.org/username/repository.git

当运行 composer update --no-dev 时,Composer将要求您输入用户名/密码组合进行身份验证。 Next Composer将提供您将这些凭据保存在 /Users/username/.composer/auth.json 中,还可以参阅: https://getcomposer.org/doc/articles/http-basic-authentication.md

When running composer update --no-dev, Composer will ask you for the username / password combination to authenticate. Next Composer will offer you to save these credentials in /Users/username/.composer/auth.json, also see: https://getcomposer.org/doc/articles/http-basic-authentication.md

选择Y创建该文件。

现在将创建的 auth.json 复制到您的项目文件夹。使用git添加,提交并将其推送到Heroku。

Now copy the created auth.json to your project folder. Use git to add, commit and push it to Heroku.

这对我来说有用,不幸的是, auth.json 将您的密码存储在纯文本中,所以对我来说不是一个理想的解决方案...

This worked for me, unfortunately the auth.json stores your password in plain text, so for me it is not an ideal solution...

有人从Heroku监控这个问题?当使用 http://www.CloudControl.com 时,可以检查应用程序的详细信息,其中包括公钥。添加到BitBucket它的工作原理。或者使用Composer正确使用公钥,可以添加到Heroku ...

Somebody from Heroku monitoring this issue? When using http://www.CloudControl.com one can inspect the details of an application, which includes a public key. Add that to BitBucket and it works. Either that or have Composer properly use the public keys one can add to Heroku...

这篇关于如何提供对Composer使用的git存储库的访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆