user2573863
user2573863

Reputation: 693

Clone git repository via composer

guys! I simply want to clone repository via composer. But unfortunately - i can't.

My composer.json looks like:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://bitbucket.org/yuriikrevnyi/bitrix-teil-framework"
        }
    ],
    "require": {
        "mockery/mockery": "dev-master@dev",
        "phpunit/phpunit": "3.7.*"
    }
}

But its not going to work. So, couldnt you help me a little bit?

And there is one more question. How to 'clone' private repo with composer? Lets say, we have same repo - https://bitbucket.org/yuriikrevnyi/bitrix-teil-framework. And admin password is - PASSWORD

So, how the composer.json should look now?

Thanks!

Upvotes: 0

Views: 1508

Answers (2)

mina.nsami
mina.nsami

Reputation: 431

The respositories section is only to define packages that are not present in the packagist.org database, but it is present on a 'source control'.

So, it is like you tell composer in your composer.json that there is a package which is source controlled, and here are the details where you get it from, by defining url .. etc.

But that is not enough, because that is only definition and not consuming (downloading) the package. In order to do so, you need to add it to your require section as well.

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://bitbucket.org/yuriikrevnyi/bitrix-teil-framework"
    }
  ],
  "require": {
    "mockery/mockery": "dev-master@dev",
    "phpunit/phpunit": "3.7.*",
    "yuriikrevnyi/bitrix-teil-framework": "*"
  }
}

Upvotes: 1

Sven
Sven

Reputation: 70933

In your posted composer.json you are stating multiple facts.

  1. You state that the software this composer.json belongs to requires the packages named "mockery/mockery" and "phpunit/phpunit".
  2. You also state that there is some repository existing that might contain some software.

What you are not stating is that Composer should clone that repository - and you cannot do this with Composer. Composer will by default only know about packages registered at packagist.org, and additionally will look into any declared repository to see which software is in there in case that software is required.

So without having another composer.json in that repository hosted at Bitbucket, nothing will happen. Also, without requiring the software that is hosted there, nothing will happen.

Your problem description is missing the most important parts to help ypu better:

  1. Describe what you were doing.
  2. Describe the expected result.
  3. Describe the actual result and how it differs from the expected result.

What you are describing is roughly point 1 (could have more details), your words "it does not work" fails to describe point 3, and point 2 is missing alltogether.

Upvotes: 1

Related Questions