在任何分支或标记中都找不到有效的composer.json

时间:2016-01-26 15:27:54

标签: git composer-php

我创建了一个包含Composer包的私有Git存储库。 我的composer.json位于回购的根目录中:

{
    "name": "vendor/nameofpackage",
    "type": "library",
    "description": "blaaa",
    "license": "All rights reserved.",
    "version": "0.0.1",
    "keywords": ["a", "b", "c"] 
}

但是如果我想运行任何Composer命令(使用-v),我会得到:

[Composer\Repository\InvalidRepositoryException]
No valid composer.json was found in any branch or tag of [url], could not load a package from it.

Exception trace:
 () at phar://D:/wamp/www/mosaicgenerator/skeletonmosaic/api/composer.phar/src/Composer/Repository/VcsRepository.php:265
 Composer\Repository\VcsRepository->initialize() at phar://D:/wamp/www/mosaicgenerator/skeletonmosaic/api/composer.phar/src/Composer/Repository/ArrayRepository.php:179
 Composer\Repository\ArrayRepository->getPackages() at phar://D:/wamp/www/mosaicgenerator/skeletonmosaic/api/composer.phar/src/Composer/DependencyResolver/Pool.php:104
 Composer\DependencyResolver\Pool->addRepository() at phar://D:/wamp/www/mosaicgenerator/skeletonmosaic/api/composer.phar/src/Composer/Command/ShowCommand.php:300
 Composer\Command\ShowCommand->getPackage() at phar://D:/wamp/www/mosaicgenerator/skeletonmosaic/api/composer.phar/src/Composer/Command/ShowCommand.php:129
 Composer\Command\ShowCommand->execute() at phar://D:/wamp/www/mosaicgenerator/skeletonmosaic/api/composer.phar/vendor/symfony/console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at phar://D:/wamp/www/mosaicgenerator/skeletonmosaic/api/composer.phar/vendor/symfony/console/Application.php:844
 Symfony\Component\Console\Application->doRunCommand() at phar://D:/wamp/www/mosaicgenerator/skeletonmosaic/api/composer.phar/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at phar://D:/wamp/www/mosaicgenerator/skeletonmosaic/api/composer.phar/src/Composer/Console/Application.php:167
 Composer\Console\Application->doRun() at phar://D:/wamp/www/mosaicgenerator/skeletonmosaic/api/composer.phar/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at phar://D:/wamp/www/mosaicgenerator/skeletonmosaic/api/composer.phar/src/Composer/Console/Application.php:98
 Composer\Console\Application->run() at phar://D:/wamp/www/mosaicgenerator/skeletonmosaic/api/composer.phar/bin/composer:43
 require() at D:\wamp\www\mosaicgenerator\skeletonmosaic\api\composer.phar:25

我绝对可以访问Git仓库,没关系。它只有主分支(没有分支)。

有什么想法吗?

2 个答案:

答案 0 :(得分:0)

如果这是一个供所有人使用的公共包。您必须在Packagist注册它,以便您的本地Composer可以找到它。

如果这是私人套餐,仅适用于您或您的团队。然后在本地composer.json中使用Composer的私有存储库解决方案:

{
    "require": {
        "vendor/my-private-repo": "dev-master"
    },
    "repositories": [
        {
            "type": "vcs",
            "url":  "git@bitbucket.org:vendor/my-private-repo.git"
        }
    ]
}

有关详细信息,请参阅Composer Docs

答案 1 :(得分:0)

好的,正如我发现的那样,服务器上存在SSL证书问题,因此git和composer无法正常工作。