問(wèn)題描述
我的 compsoser.json 使用來(lái)自我們組織 Github 帳戶(hù)的 2 個(gè)私有存儲(chǔ)庫(kù),如下所示.
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"
}
}
我們已經(jīng)設(shè)置了 SSH 密鑰并將它們添加到我們的臨時(shí)服務(wù)器上的授權(quán)密鑰中.當(dāng)我們運(yùn)行 git clone 時(shí),它??運(yùn)行良好,不需要任何憑據(jù).
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.
然而,當(dāng)我們運(yùn)行 composer update 時(shí),存儲(chǔ)庫(kù)的獲取失敗,因?yàn)?composer 無(wú)權(quán)訪問(wèn)存儲(chǔ)庫(kù).
However, when we run composer update the fetching of the repositories fails because composer doesn't have access to the repositories.
由于這是以非交互式方式運(yùn)行的,因?yàn)檫@是構(gòu)建腳本的一部分,我們無(wú)法輸入憑據(jù)并希望將其自動(dòng)化.
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.
我們可以做些什么來(lái)讓 Composer 在構(gòu)建期間訪問(wèn)我們的私有存儲(chǔ)庫(kù)?
What can we do to let composer have access to our private repo's during the build?
推薦答案
您可以配置 composer 使用密鑰文件訪問(wèn)私有倉(cāng)庫(kù).
You can configure composer to use key files to access private repository.
更多信息:https://getcomposer.org/doc/articles/handling-private-packages-with-satis.md#security
這篇關(guān)于在構(gòu)建服務(wù)器上使用 VCS 在 GitHub 上使用 Composer 和私有存儲(chǔ)庫(kù)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!