在Build Server上使用VCS在GitHub上使用Composer和Private Repository [英] Using Composer and Private Repository on GitHub using VCS on Build Server

查看:286
本文介绍了在Build Server上使用VCS在GitHub上使用Composer和Private Repository的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的compsoser.json使用来自我们组织Github帐户的2个私人存储库,如下所示。

  {
name:API,
repositories:[
{
type:vcs,
url:git@github.com/company /private.git
},
{
type:vcs,
url:git@github.com/company/private2.git
}
],
require:{
php:> = 5.3.3,
zendframework / zendframework:> 2.1 .3,
doctrine / mongodb-odm:dev-master,
doctrine / doctrine-mongo-odm-module:dev-master,
company / private:dev-master,
company / private2:dev-master
}
}

我们已经设置了SSH密钥,并将它们添加到临时服务器上的授权密钥。但是,当我们运行composer update时,存储库的获取失败,因为composer不会使用git clone。有权访问存储库。



由于这是以非互动方式运行的,因为这是构建脚本的一部分,我们无法输入凭据,希望自动执行。


解决方案

我们可以做什么让编译器在构建过程中访问我们的私有仓库?

您可以将composer配置为使用密钥文件访问私人存储库。



更多信息: https://getcomposer.org/doc/articles/handling-private-packages-with-satis.md#security


My compsoser.json uses 2 private repositories from our Organisation Github Account and is as follows.

{
    "name": "API",
    "repositories": [
      {
        "type": "vcs",
        "url": "git@github.com/company/private.git"
      },
      {
        "type": "vcs",
        "url": "git@github.com/company/private2.git"
      }
    ],
    "require": {
        "php": ">=5.3.3",
        "zendframework/zendframework": ">2.1.3",
        "doctrine/mongodb-odm": "dev-master",
        "doctrine/doctrine-mongo-odm-module": "dev-master",
        "company/private": "dev-master",
        "company/private2": "dev-master"
    }
}

We've setup SSH keys and added them to the authorized keys on our staging server. When we run git clone it works perfectly and isn't asking for any credentials.

However, when we run composer update the fetching of the repositories fails because composer doesn't have access to the repositories.

Since this is ran in a non-interactive way as this is part of a build script we can't enter credentials and like to have this automated.

What can we do to let composer have access to our private repo's during the build?

解决方案

You can configure composer to use key files to access private repository.

More info: https://getcomposer.org/doc/articles/handling-private-packages-with-satis.md#security

这篇关于在Build Server上使用VCS在GitHub上使用Composer和Private Repository的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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