Composer Private Repository .git-folder keeps being generated

时光怂恿深爱的人放手 提交于 2019-12-08 13:10:38

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/21954327/composer-private-repository-git-folder-keeps-being-generated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!