Composer - adding git repository without composer.json

后端 未结 2 867
说谎
说谎 2021-02-04 07:24

I try to add repository from github (designmodo/Flat-UI), play with config and get errors No valid composer.json was found in any branch or..., Your requireme

相关标签:
2条回答
  • 2021-02-04 08:01

    It only worked for me removing the label, like this:

    {
            "repositories":[
            {              
                "type": "package",
                "package": {
                  "name": "designmodo/Flat-UI",
                  "version": "1.3.0",
                  "source": {
                    "url": "https://github.com/designmodo/Flat-UI",
                    "type": "git",
                    "reference": "master"
                  }
                }
            }
            ],
            "require": {
                "twbs/bootstrap-sass": "~3.2",
                "designmodo/Flat-UI": "*"
            }, 
    }
    
    0 讨论(0)
  • 2021-02-04 08:17

    Problem solved. Play around and changed reference to master and version to any * in "designmodo/Flat-UI": "*" section. After that composer download package via git and update composer.lock without problems. Should work for any github repos.

    Working config:

    {
        "repositories": {
          "flat-ui": {
            "type": "package",
            "package": {
              "name": "designmodo/Flat-UI",
              "version": "1.3.0",
              "source": {
                "url": "https://github.com/designmodo/Flat-UI",
                "type": "git",
                "reference": "master"
              }
            }
          }
        },
        "require": {
            "twbs/bootstrap-sass": "~3.2",
            "designmodo/Flat-UI": "*"
        },
    }
    

    https://getcomposer.org/doc/05-repositories.md

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