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.

  • Jenkins - Get code from BitBucket with SSH
  • Unable to push changes to remote repository with multiple users
  • Is possible to list the git repository issues in command line?
  • Failed to start Git process
  • Updating git from a version without .git history
  • How to push/deploy project on digital ocean without git clone
  • How do I put my private repository which is hosted on Bitbucket in a composer.json file without making it public?

  • git lock keeps coming back on commit rendering GIT useless
  • Bitbucket Webhooks
  • Bitbucket: Conflict in remote repo, can't figure out how to resolve
  • Composer - adding git repository without composer.json
  • How to add git repo to working dir of a project
  • How to mark an issue as resolved from the commit log?
  • 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.