gpt4 book ai didi

gitlab-ci - 亚搏体育appCI : "Permission denied" when pulling private composer package

转载 作者:行者123 更新时间:2023-12-01 14:36:54 24 4
gpt4 key购买 nike

我正在尝试使用 GitLab 设置 CI,但出现此构建错误:

  [RuntimeException]         

Failed to execute git clone --no-checkout 'git@***.git' '/builds/***' && cd '/builds/***' && git remote add composer 'git@***.git' && git fetch composer
Cloning into '/builds/***'...

Permission denied, please try again.

Permission denied, please try again.
Permission denied (publickey,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

我的 composer.json 看起来像这样:
{
"repositories": [
{
"type": "git",
"url": "git@***.git"
}],
}

它显然与 ssh key 对有关,但我不知道在哪里存储私钥/公钥。

最佳答案

我刚刚为此实现了一个解决方案,基于 https://docs.gitlab.com/ee/ci/ssh_keys/README.html以及 https://gitlab.com/gitlab-examples/ssh-private-key/blob/master/.gitlab-ci.yml 上的示例.

你基本上需要

  • 设置 SSH 代理(尤其是使用 docker 时)
  • 添加私有(private) SSH key (最好来自存储在 GitLab 中的变量,因为不应 checkin 凭据)

  • 例如,如果链接被移动:
    before_script:
    # install ssh-agent
    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'

    # run ssh-agent
    - eval $(ssh-agent -s)

    # add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
    - ssh-add <(echo "$SSH_PRIVATE_KEY")

    # Set up project.
    - composer install

    关于gitlab-ci - 亚搏体育appCI : "Permission denied" when pulling private composer package,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44444727/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com