如何将私人github存储库添加为Composer依赖项 [英] How to add private github repository as Composer dependency
问题描述
我在Laravel 5.1项目composer.json中添加了一个公共github库作为依赖项。
。 ..
repositories:[
{
type:package,
package:{
name:myVendorName / my_private_repo ,
version:1.2.3,
source:{
type:git,
url:git:// github .com / myVendorName / my_private_repo.git,
reference:master
},
dist:{
url:https:// github .com / myVendorName / my_private_repo / archive / master.zip,
type:zip
}
}
}
],
require:{
....
myVendorName / my_private_repo:*,
},
...
只要存储库是公共的,它就可以工作。现在我已经将这个存储库设置为私有。我用于拉取/推送到'my_private_repo'的git凭证是该项目的合作者之一。当我运行作曲家更新或作曲家安装 ?
在GitHub和BitBucket上使用私有存储库:
JSON
{
require:{
vendor / my-private-repo:dev-master
},
repositories:[
{
type:vcs,
url:git@bitbucket.org:vendor / my-private-repo.git
}
]
}
唯一的要求是为git客户端安装SSH密钥。
I have the following in my Laravel 5.1 projects composer.json to add a public github repository as a dependency.
...
"repositories": [
{
"type": "package",
"package": {
"name": "myVendorName/my_private_repo",
"version": "1.2.3",
"source": {
"type" : "git",
"url" : "git://github.com/myVendorName/my_private_repo.git",
"reference" : "master"
},
"dist": {
"url": "https://github.com/myVendorName/my_private_repo/archive/master.zip",
"type": "zip"
}
}
}
],
"require": {
....
"myVendorName/my_private_repo": "*",
},
...
This works as long as the repository is public. Now I've set this repository to private. The git credentials I use for pulling/pushing to 'my_private_repo' are the one of a colaborator of the project. How can I achieve that composer pulls from that private repository when I run composer update or composer install?
Work with private repositories at GitHub and BitBucket:
JSON
{
"require": {
"vendor/my-private-repo": "dev-master"
},
"repositories": [
{
"type": "vcs",
"url": "git@bitbucket.org:vendor/my-private-repo.git"
}
]
}
The only requirement is the installation of SSH keys for a git client.
这篇关于如何将私人github存储库添加为Composer依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!