Pulling my own private repository from Bitbucket v

2019-07-25 06:38发布

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?

1条回答
倾城 Initia
2楼-- · 2019-07-25 07:32

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).

查看更多
登录 后发表回答