首页 > 解决方案 > Composer 不会从私有 git 存储库克隆

问题描述

我有一个项目,它有一个私有 gitlab 存储库作为其依赖项之一。composer.json包含这个:

"repositories": [
        {
            "type": "vcs",
            "url": "git@git.my_gitlab_domain.com:my/project.git"
        },
]

可以通过 ssh 访问这个存储库,这意味着我可以使用它下载它,git clone而无需输入密码或用户名。但是,当我尝试使用composer installcomposer 安装依赖项时,要求我输入另一个用户的密码(我没有,我的用户名是ssagitov):

- Syncing my/project (dev-master 620b5ef) into cache
git@git.my_gitlab_domain.com's password:

我尝试全局配置作曲家以直接通过以下方式使用我的密码:

composer config --global http-basic.git.my_gitlab_domain.com ssagitov my_password

那没有用,所以我尝试使用

composer config --global gitlab-token.git.my_gitlab_domain.com my_personal_access_token

我还将 git.my_gitlab_domain.com 添加到gitlab-domains

composer config --global gitlab-domains git.my_gitlab_domain.com

正如你所看到的,这些都不起作用,所以我没有想法,我该如何解决这个问题?

标签: phpgitgitlabcomposer-php

解决方案


推荐阅读