Pulling my own private repository from Bitbucket via Composer

时光毁灭记忆、已成空白 提交于 2019-12-10 22:33:59

问题


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:


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



来源:https://stackoverflow.com/questions/37784991/pulling-my-own-private-repository-from-bitbucket-via-composer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!