問題描述
我的 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
這篇關于在構建服務器上使用 VCS 在 GitHub 上使用 Composer 和私有存儲庫的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!