简体   繁体   中英

Add custom repository to composer

I have a gitlab repo: http://gitlabPerso/gitlab/PROJECTS/my-project.git

And I would like to add it to my current composer.json project.

However it keeps saying me:

  • The requested package project/MyProjectBundle could not be found in any version, there may be a typo in the package name.

This is what I tried:

"repositories": [
    {
        "type": "package",
        "package": {
            "name": "project/MyProjectBundle",
            "version": "dev-master",
            "type": "package",
            "source": {
                "url": "http://gitlabPerso/gitlab/PROJECTS/my-project.git",
                "type": "git",
                "reference": "master"
            }
        }
    }
],
"require": {
    "project/MyProjectBundle": "*"
 }

And the composer.json in this project looks like this:

{
"name" : "project/MyProjectBundle",
"description" : "some description", 
"type" : "symfony-bundle",
"license": [
    "MIT"
],
"require" : {
        "php" : ">=5.3.0"
},
"minimum-stability": "dev",
"prefer-stable": true
}

I tried many other solutions I found on the net, I RTFM, but it still doesn't work.

Try with:

"repositories": [
    {
        "type": "vcs",
        "url": "http://gitlabPerso/gitlab/PROJECTS/my-project.git"
    }
],
"require": {
    "project/MyProjectBundle": "*"
}

I finally find this solution:

"repositories": [
    {
        "type": "git",
        "url": "repogit.git"
    }
],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM