At work I forked the git repository of a TYPO3 extension, created a branch and tried to install it in my project - but composer failed to find it.
At first I added a repositories section with my forked github repo as vcs repository:
"repositories": [ { "type": "vcs", "url": "https://github.com/mogic-le/aus_driver_amazon_s3" } ],
Then I tried to install my branch:
$ composer require andersundsehr/aus-driver-amazon-s3:dev-mogic-v13 ./composer.json has been updated Running composer update andersundsehr/aus-driver-amazon-s3 Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - Root composer.json requires andersundsehr/aus-driver-amazon-s3 dev-mogic-v13, found andersundsehr/aus-driver-amazon-s3[dev-feature/unbundle-sdk, dev-feature/matrix-tests, dev-functional-tests-alternative, dev-task/fixTests, dev-master, dev-TYPO3v13, dev-bugfix/clear-transient-file, 1.3.2, ..., 1.13.5, 2.0.0] but it does not match the constraint. Installation failed, reverting ./composer.json to its original content.
After half an hour I finally found the reason:
$ composer validate ./composer.json is valid, but with a few warnings See https://getcomposer.org/doc/04-schema.md for details on the schema # General warnings - Key repositories is a duplicate in ./composer.json at line 68
My composer.json already had a "repositories" section at the end, but I added a new section near the beginning. The section at the end overwrote the one at the beginning, and so composer never saw my custom repository.