Pulling my own private repository from Bitbucket via Composer

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.

  • Use GitHub for Windows for both Bitbucket and GitHub
  • SSH KEY Already Exists Bitbucket
  • Revert a merged pull request on BitBucket
  • Dealing with declined pull request in bitbucket
  • Recovering a deleted branch from a remote on Bitbucket (git)
  • Using Jenkins with a private BitBucket Git repository
  • How do I put my private repository which is hosted on Bitbucket in a composer.json file without making it public?

  • How to change a past git commit+push message in RubyMine?
  • Bitbucket activity graph
  • Composer install/update not working
  • Git SourceTree - Uncommitted Submodules
  • BitBucket Jenkins doesn't automatically build
  • How to use Bitbucket as a maven remote repository?
  • One Solution collect form web for “Pulling my own private repository from Bitbucket via Composer”

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

    Git Baby is a git and github fan, let's start git clone.