简体   繁体   English

通过composer克隆git存储库

[英]Clone git repository via composer

guys! 伙计们! I simply want to clone repository via composer. 我只想通过composer克隆存储库。 But unfortunately - i can't. 但不幸的是 - 我做不到。

My composer.json looks like: 我的composer.json看起来像:

{
    "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 . 可以说,我们有相同的回购 - https://bitbucket.org/yuriikrevnyi/bitrix-teil-framework And admin password is - PASSWORD 管理员密码是 - 密码

So, how the composer.json should look now? 那么,composer.json现在应该怎么样?

Thanks! 谢谢!

In your posted composer.json you are stating multiple facts. 在你发布的composer.json你说的是多个事实。

  1. You state that the software this composer.json belongs to requires the packages named "mockery/mockery" and "phpunit/phpunit". 您声明此composer.json所属的软件需要名为“mockery / mockery”和“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应该克隆该存储库 - 而您无法使用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. 默认情况下,Composer只会知道在packagist.org注册的packagist.org ,并且还会查看任何已声明的存储库,以便在需要软件时查看其中的软件。

So without having another composer.json in that repository hosted at Bitbucket, nothing will happen. 因此,在Bitbucket托管的存储库中没有另一个composer.json ,什么都不会发生。 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: 您的问题描述缺少帮助ypu更好的最重要的部分:

  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. 你所描述的大致是第1点(可能有更多细节),你的话“它不起作用”无法描述第3点,而第2点完全没有。

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'. respositories部分仅用于定义packagist.org数据库中不存在的包,但它存在于“源控件”中。

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. 所以,就像你告诉composer.json中的composer.json有一个源代码控制的包,这里是你从中获取它的细节,通过定义url等。

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", "*"
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM