9

I have some problem with composer.

 "require": {
        "php":                ">=5.3.2",
        "kriswallsmith/buzz": "0.7"
    },

Repo https://github.com/kriswallsmith/Buzz/tree/v0.7

Unfortunately github returns 502 for this request https://github.com/kriswallsmith/Buzz/zipball/v0.7

Request URL:https://nodeload.github.com/kriswallsmith/Buzz/zipball/v0.7
Status Code: 502 Bad Gateway

Luckily git clone still works ;)

Is it possible to tell/ask composer to user git clone instead of downloading zipball for this one dependency?

3 Answers 3

10

The quickest solution is to run install or update with the option --prefer-source

php composer.phar install --prefer-source

In this way git clone will be used for all dependencies, I don't know if there's a setting to limit to one dependency only.

1
  • In composer.json it seems you should be able to enforce this, via { ... "type": "project", "config": { "preferred-install": "source" }, ... } but in my experience that seems to get ignored. So the above command appears to be the only way to do it. Sep 8, 2014 at 18:19
7

As explained in preferred-install order matters. I've tested on Composer version 1.8.3 2019-01-30 08:31:33

"config": {
    "preferred-install": {
        "drupal/external_entities": "source",
        "*": "dist"
    }
}

Next ran

composer require drupal/external_entities

and the git repo appeared.

0

There's another way than prefer source, you can set repository with type 'VCS' it means that that package will be search in your VCS for example GIT instead of packagist

your composer.json

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/kriswallsmith/Buzz"
        }
    ],
    "require": {
        "kriswallsmith/buzz": "dev-0.17.x"
    }
}

More info here

2
  • Testing this in July 2020, looks like this will only download a copy of the repository, but not do a 'git clone' on it. The implication is that this is fine for using the code, but not for modifying and contributing back to the repository.
    – JJ Rohrer
    Jul 28, 2020 at 12:26
  • Of course, it'll do it. If you want to modify the code you can create PR in the main repository or you can fork the project and use it as you wish.
    – Robert
    Jul 29, 2020 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.