在 GitHub 上使用 Composer 和 Private Repository 在 Build Server 上使用 VCS

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

问题描述

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

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"
    }
}

我们已经设置了 SSH 密钥并将它们添加到我们登台服务器上的授权密钥中.当我们运行 git clone 时,它​​可以完美运行,并且不需要任何凭据.

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.

但是,当我们运行 composer update 时,由于 composer 无权访问存储库,因此获取存储库失败.

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.

我们可以做些什么来让 composer 在构建过程中访问我们的私有仓库?

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

推荐答案

您可以配置composer使用密钥文件访问私有仓库.

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

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

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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)