Use PHP composer to clone git repo

后端 未结 8 1092
难免孤独
难免孤独 2020-11-30 16:57

I\'m trying to use composer to automatically clone a git repository from github that isn\'t in packagist but it\'s not working and I can\'t figure out what am I doing wrong.

相关标签:
8条回答
  • 2020-11-30 17:35

    I was encountering the following error: The requested package my-foo/bar could not be found in any version, there may be a typo in the package name.

    If you're forking another repo to make your own changes you will end up with a new repository.

    E.g:

    https://github.com/foo/bar.git
    =>
    https://github.com/my-foo/bar.git
    

    The new url will need to go into your repositories section of your composer.json.

    Remember if you want refer to your fork as my-foo/bar in your require section, you will have to rename the package in the composer.json file inside of your new repo.

    {
        "name":         "foo/bar",
    
    =>
    
    {
        "name":         "my-foo/bar",
    

    If you've just forked the easiest way to do this is edit it right inside github.

    0 讨论(0)
  • 2020-11-30 17:35

    In my case, I use Symfony2.3.x and the minimum-stability parameter is by default "stable" (which is good). I wanted to import a repo not in packagist but had the same issue "Your requirements could not be resolved to an installable set of packages.". It appeared that the composer.json in the repo I tried to import use a minimum-stability "dev".

    So to resolve this issue, don't forget to verify the minimum-stability. I solved it by requiring a dev-master version instead of master as stated in this post.

    0 讨论(0)
提交回复
热议问题