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.

  • Git on Bitbucket: Always asked for password, even after uploading my public SSH key
  • Git cannot lock ref 'HEAD': unable to resolve reference HEAD
  • Understanding Git with XCode and BitBucket
  • Git .pack file is too large
  • Using Jenkins with a private BitBucket Git repository
  • Trigger a jenkins build from git using cloudbees and bitbucket
  • How do I put my private repository which is hosted on Bitbucket in a composer.json file without making it public?

  • Build Bamboo from Bitbucket, Deploy to Azure Cloud
  • Rsync to Google Compute engine Instance from Jenkins
  • git pull hangs after authentication
  • Git Commits appear in Bitbucket but not in SourceTree
  • bitbucket access not working
  • Use own username/password with git and bitbucket
  • 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.