简体   繁体   English

通过composer从私有Bitbucket存储库导入包

[英]Importing package from a private Bitbucket repository through composer

I have a package setup in a private Bitbucket repository that I use across a variety of Laravel based client projects. 我在私有Bitbucket存储库中有一个软件包设置,我在各种基于Laravel的客户端项目中使用它。 I find I am regularly adding to it and would like to be able to update each client's project using composer as needed with the latest edition. 我发现我经常添加它,并希望能够根据需要使用最新版本的作曲家更新每个客户的项目。

How do I add an entry into composer to pull from the Bitbucket git repository without having to expose my personal repository login/password to the clients in the composer.json file? 如何将一个条目添加到composer中以从Bitbucket git存储库中提取,而不必将我的个人存储库登录名/密码公开给composer.json文件中的客户端?

Use ssh authentication and configure some Deployment Keys : 使用ssh身份验证并配置一些部署密钥

  • Go into "Project Settings -> Deployment Keys" 进入“项目设置 - >部署密钥”
  • Then add a different deployment key for each of your clients. 然后为每个客户端添加不同的部署密钥。

You can find more info on the links on how to set-up ssh authentication with Mercurial or Git. 您可以在有关如何使用Mercurial或Git设置ssh身份验证的链接上找到更多信息。

I have some problem with bitbucket private repos... So I've added something like this in my project root's composer.json. 我在bitbucket私有回购中遇到了一些问题...所以我在我的项目root的composer.json中添加了这样的东西。

"require"     : {
            "php"                                      : ">=5.4.0",
            ...,
            "author/my-package"                     : "0.2"
},

"repositories": [
            {
                "type"   : "package",
                "package": {
                    "name"   : "author/my-package",
                    "version": "0.2",
                    "source" : {
                        "url"      : "ssh://hg@bitbucket.org/author/my-package",
                        "type"     : "hg",
                        "reference": "0.2"
                    },
                    "require": {
                        "php": ">=5.4.0",
                        "zendframework/zendframework": "2.3.*"
                    },
                    "autoload": {
                        "psr-0": {
                            "PackageNameSpace": "src/"
                        },
                        "classmap": [
                            "./Module.php"
                        ]
                    }
                }
            },
    ...
    ]

So after composer.phar update it creates repo dir in vendor... But after new commit in private repo and composer.phar update it doesn't pull last changeset... It stays on head that was on first repo import 所以在composer.phar更新之后它会在供应商中创建repo dir ...但是在私有repo和composer.phar更新后的新提交它没有拉最后一个变更集...它仍然在第一个repo导入的头上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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