English 中文(简体)
• 如何增加私人储存库作为依赖物
原标题:How to add private github repository as Composer dependency

我在拉维尔5.1项目中拥有以下内容。 json 添加公用金库作为附属物。

...    
"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": "*",
},
...

只要存放处是公开的,就可进行这项工作。 现在,我把这个存放处设于私人。 我将 credentials/pu带给我的私人_repo,是该项目的一个实验室。 当我操作composer Updatecomposerstal时,我怎么能从该私人存放处提取该堆肥?

最佳回答

与Gite Hub和Bucket私人仓库合作:

http://www.ohchr.org。

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

唯一的要求是安装SSH钥匙,供客户使用。

问题回答

我希望,我的回答不会太晚,因为我刚刚认识到这一点。

Generating a ssh key

你们可以产生由sh子指挥的N+1轴心。 确保你在服务器上这样做!

➜  ~ cd ~/.ssh
➜  .ssh ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa): repo1
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in repo1.
Your public key has been saved in repo1.pub.
The key fingerprint is:
SHA256:EPc79FoaidfN0/PAsjSAZdomex2J1b/4zUR6Oj7IV2o user@laptop
The key s randomart image is:
+---[RSA 2048]----+
|      . . o ..   |
|       o B o ..  |
|      . + B o  . |
|       . * B = .o|
|        S B O B+o|
|         o B =.+*|
|          o....Bo|
|            o E.o|
|             +.o |
+----[SHA256]-----+

在使用sh子指挥后,将促使你掌握档案名称和密码。 你们需要每个私人存放处的关键,你们将重新用作堆肥。 例如,文件1是档案名称。

保证你离开信道和确认书空洞。

Configuring the ssh to pick up the correct key

在服务器“~/ssh/config”档案中,你可以为每个Gite Hub存放处分配一个别处。 否则,堆肥器就试图使用 default子。

Host repo1
HostName github.com
User git
IdentityFile ~/.ssh/repo1
IdentitiesOnly yes

Host repo2
HostName github.com
User git
IdentityFile ~/.ssh/repo2
IdentitiesOnly yes

Configuring Composer

在项目堆肥中。 json案,你需要补充你希望的存放处:

"repositories": [
    {
        "type": "vcs",
        "url": "repo1:YourAccount/repo1.git"
    },
    {
        "type": "vcs",
        "url": "repo2:YourAccount/repo2.git"
    }
],

页: 1 4. 吉特·霍赫特的回历1为:

[电子邮件受保护]:YourAccount/repo1.git

现在,应该为大家树立美好的榜样。 您现在可以要求您:

<代码>composer demand Youaccount/repo1 -n

<代码>composer demand Youaccount/repo2 -n

NB! 在使用吉特·布赖斯库作为堆肥器时,你总是需要增加——每个 compos子的指挥。

1. Point to the Git repository

更新堆肥器。

    "repositories":[
      {
        "type": "vcs",
        "url": "[email protected]:vendor/secret.git"
      }
    ]

2. Creat an SSH key

建立SSH 贵方希望安装成套设备的关键。

如果你在开发机器上工作,你很可能想给您的Gite/BitBucket/GitLab账户增加SSH的钥匙。 这使人能够进入贵国账户能够进入的所有私人仓库。

关于如何增加Github、Bibucket或Gitelab SSH钥匙的更多信息,见,excellent article

如果你配置了部署服务器,最好配置一个接入钥匙或部署钥匙。 准入钥匙只能提供使用单一存放处的机会,从而可以进行更为具体的准入管理。

3。

现在只是堆肥器要求或composer 装置

从指挥线上看,你可以让 compos子确保你在 compos子中留下有效的 j子。 json案,用类似指挥,没收贵存放处:

composer config repositories.my_alias 
     {"type": "vcs", 
      "url": "[email protected]:my_repo.git", 
      "ssh2": { "username": "git", 
                "privkey_file": "/var/lib/jenkins/.ssh/id_rsa", 
                "pubkey_file": "/var/lib/jenkins/.ssh/id_rsa.pub" 
              } 
    } 

<>光> 我没有在引证的属性内用线连续性测试。 我的成功测试涉及在一条单一线上进行。 但我发现,这种格式便于人们以这种格式理解。

www.un.org/Depts/DGACM/index_spanish.htm FURTHER NOTE: 该指挥部将继续犯错误,直到您的<代码>sh-keygen为止。 正如对该问题的其他答复所描述的那样,钥匙已经到位,贵方的公用钥匙被重新配置。

执行这一指挥结果是我的 compos子下台。 json file:

    "repositories": {
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        "my_alias": {
            "type": "vcs",
            "url": "[email protected]:my_repo.git",
            "ssh2": {
                "username": "git",
                "privkey_file": "/var/lib/jenkins/.ssh/id_rsa",
                "pubkey_file": "/var/lib/jenkins/.ssh/id_rsa.pub"
            }
        }
    },

This usage is documented here: https://getcomposer.org/doc/03-cli.md#config





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签