Composer with Bitbucket Private Repository

Create a Composer project and push it to your repo:

composer init

Create Bitbucket OAuth Consumer here.

  • Fill the callback URL with http://example.com

This command will generate ./auth.json file. Use --global flag to generate ~/.composer/auth.json file.

composer config --auth bitbucket-oauth.bitbucket.org <oauth-consumer-key> <oauth-consumer-secret>

Add the private repository to ./composer.json. Use --global flag to generate ~/.composer/config.json file.

composer config repositories.<vendor>/<package> vcs https://bitbucket.org/<username>/<repository>

Install the package from the private repository.

We use dev-* prefix to checkout a branch. Use *-dev suffix if the branch name is using version naming. Click here for more info.

composer require <vendor>/<package>:dev-main

Or we can use the "minimum-stability": "dev". Click here for more info. This will pull the default “MAIN” branch.

composer require <vendor>/<package>

REFERENCES:


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *