Domanda

I could not find a solution for this, so I'm asking for help here. I created a private Git-Repository on Bitbucket, which I want to use within my composer-project.

Everything is working so far. The thing is, a .git-folder keeps being generated, which I really don't want to have. (I just want to use the package from a private-repository, nothing else!)

My composer.json in the root-project looks like this:

{
    ...
    "require": {
        "vendorname/packagename": "*"
    },
    "repositories": [
        "type": "git",
        "url": "git@bitbucket.org:vendor/package.git"
    ]
    ...
    "config": {
    "preferred-install": "dist"
},
"minimum-stability": "dev"
}

I tried setting the type to vcs, without a change. Could it be the preferred-install parameter?

I would appreciate any kind of help. It seems like I missed something here.

È stato utile?

Soluzione

Composer offers to handle Bitbucket as special source with automatic knowledge of distribution download urls, but this only works with "https" repository urls.

https://github.com/composer/composer/blob/master/src/Composer/Repository/Vcs/GitBitbucketDriver.php#L36

So because Composer does not know how to construct a download url for "git" protocol references to Bitbucket, it defaults to cloning the repo instead.

And I'd say that trying to program this is rather a difficult challenge, because there is no official "download" channel in the git protocol, and switching from git to https will also be hard because the git url is missing some important info that is needed to create the https download url. Not thinking about the problems with authentication.

If you can create a download location for your software and host the ZIP files anywhere, you'd be able to mention this in the composer.json file of the library, or in the repository definition of your root project. Note that this will be hard to maintain, because it is done manually.

The better solution would be to create a Satis instance which checks the Bitbucket repository and creates ZIP files of every tagged version it finds. The result could be hosted on a private server.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top