I have the following in my Laravel 5.1 projects composer.json to add a public github repository as a dependency.

...    
"repositories": [
  {
    "type": "package",
    "package": {
      "name": "myVendorName/my_private_repo",
      "version": "1.2.3",
      "source": {
        "type" : "git",
        "url" : "git://github.com/myVendorName/my_private_repo.git",
        "reference" : "master"
      },
      "dist": {
        "url": "https://github.com/myVendorName/my_private_repo/archive/master.zip",
        "type": "zip"
      }
    }
  }
],
"require": {
     ....
    "myVendorName/my_private_repo": "*",
},
...

只要存储库是公共的,这种方法就有效.现在我已经将这个存储库设置为private.我用来拉/推到"my_private_repo"的git凭证是该项目的合作伙伴之一.当我运行composer updatecomposer install时,如何实现composer从私有存储库中提取数据?

推荐答案

在GitHub和BitBucket使用私有存储库:

JSON

{
    "require": {
        "vendor/my-private-repo": "dev-master"
    },
    "repositories": [
        {
            "type": "vcs",
            "url":  "git@bitbucket.org:vendor/my-private-repo.git"
        }
    ]
}

唯一的要求是为git客户端安装SSH密钥.

Docs

Laravel相关问答推荐

灯丝:设定模式标题

Laravel:如何从不断更新的Controller中分页数据

Nginx上带有SSL的Laravel混响

如何定制有关密码被泄露的Laravel Breeze S消息?

模型文件名更改数据库中的表名

未定义防护 [api] 的授权驱动程序 [api]

从主类别模型 laravel 中获取子类别翻译

使用正则表达式 laravel 忘记缓存

(1/1) ErrorException ReflectionFunction::__construct() ex

Laravel belongsTo 关系 - 试图获取非对象的属性

将 Laravel 升级到 4.2 后,Artisan::call('migrate') 不起作用

Laravel - 加载常见的页眉和页脚以查看

Laravel 扩展验证自定义消息

在 Laravel 5.4 中将中间件应用于除 `setup/*` 之外的所有路由

如何在 Laravel 5 中验证当前、新密码和新密码确认?

判断输入是否来自控制台

将 Laravel 集合附加到另一个集合

Laravel 在保存前生成 slug

如何以 JSON 格式发送 Laravel 错误响应

将图像保存在公共文件夹中,而不是存储 laravel 5