Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

community creator

How to use Bitbucket private repository in your projects

Alessandro Minoccheri

Using Bitbucket private repository in your projects

There are times when you might want to use your personal private library in another project. For example, you may have many private projects that share a common library that can’t be open source. In this situation, you could use Packagist and pay to have a private repository, or you could use Bitbucket with its FREE private repositories.

To include your private Bitbucket repository via Composer, add the following lines into your composer.json:

         "type": "vcs",
         "url" : ""

VCS stands for “version control system.” This includes versioning systems like git, svn, fossil, or hg. The composer has a repository type for installing packages from these systems.

If you launch composer-install now, you have to put a Consumer key into your CLICommand Line Interface. This isn’t a problem, but if you have continuous integration or your deploy system launches composer install the command, you must have an automatic system that can insert the consumer key or some magic script to manage it.

So, to avoid this problem you need to open your main repository, from Bitbucket. To do this, create an ssh key and copy the public key.

After that, you need to open your private library from Bitbucket, add an access ssh key, and paste the previously created public key.

You can now launch composer-install for any request that comes up into your CLI and have a perfect automatic deployment.


community creator


Alessandro Minoccheri
Copyright ©2022 Educative, Inc. All rights reserved

View all Courses

Keep Exploring