从BitBucket通过Composer拉出我自己的私人存储库 [英] Pulling my own private repository from Bitbucket via Composer

查看:346
本文介绍了从BitBucket通过Composer拉出我自己的私人存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大型的图书馆作为一个私人存储库,位于Bitbucket上。我使用这个图书馆为我的很多项目。



我在每个项目中更新我的图书馆时都会遇到麻烦,只要我做了一些改变, d喜欢把它放在每个项目的 composer.json 文件中,然后使用 composer update 拉出最新的版本。



如何将托管在Bitbucket上的私人存储库放在 composer.json 文件中,而不进行它公开?

解决方案

首先设置ssh为git: https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html



在您需要存储库的项目的composer.json中,添加以下内容:

 repository:[
{
type:vcs,
url:git@bitbucket.org:some_name / some_repositor
参考:开发
}
],

然后你可以简单地要求它:

 vendor / projectname:* @ dev

请注意,您需要的存储库还应该有自己的composer.json,为包装设置的名称必须匹配您包含的包的名称(上面我的示例中的供应商/项目名称)。


I have a big library that is hosted on Bitbucket as a private repository. I use this library for a lot of projects of mine.

I am having a trouble updating my library in each project where it's used whenever I do some changes, therefore I'd like to simply put it in the composer.json file of each project, then use composer update to pull the newest version.

How do I put my private repository which is hosted on Bitbucket in a composer.json file without making it public?

解决方案

First set up ssh for git: https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html

In your composer.json of the project where you want to require the repository add the following:

"repositories": [
    {
        "type": "vcs",
        "url": "git@bitbucket.org:some_name/some_repository.git",
        "reference": "develop"
    }
],

Then in you can simply require it:

"vendor/projectname": "*@dev"

Note that the repository you are requiring should also have its own composer.json, the name set for the package there must match the name of the package you are including (vendor/projectname in my example above).

这篇关于从BitBucket通过Composer拉出我自己的私人存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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