簡體   English   中英

Gitlab CI/CD 無法下載私人作曲家 package

[英]Gitlab CI/CD can't download private composer package

I'm trying to download a private gitlab repository package inside my gitlab project, using the gitlab CI/CD inside a Docker container.

現在我收到以下錯誤:

- Installing {package} (dev-master 30bb2f3): Downloading    Failed to download {package} from dist: Could not authenticate against gitlab.com
80     Now trying to download from source
81   - Installing {package} (dev-master 30bb2f3): Cloning 30bb2f3bb7
82                                                                                                                                                                                                                                                                                                                           
83   [RuntimeException]                                                                                                                                                                                                                                                                                                      
84   Failed to execute git clone --no-checkout 'git@gitlab.com:{user}/{project}/{repo}.git' 

我嘗試了一切,但解決方案..
這篇文章對我沒有幫助: GitLab CI:拉私人作曲家package時“權限被拒絕”

信息

  • 我正確設置SSH,因為項目部署會成功
  • 我在我的倉庫 url 中使用部署令牌,但它沒有幫助
  • 私鑰設置為 gitlab 變量

我的.gitlab-ci.yml

.init_ssh: &init_ssh |
  which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
  eval $(ssh-agent -s)
  echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
  mkdir -p ~/.ssh
  chmod 700 ~/.ssh
  ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
  chmod 644 ~/.ssh/known_hosts
  echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config

Composer:
  stage: Build
  script:
    - *init_ssh
    - composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts

我錯過了什么嗎?

我通過這篇文章解決了這個問題: https://stackoverflow.com/a/38570269/6385459這是將公共 SSH 密鑰添加為所有私有依賴項的部署密鑰的部分。 我有一個錯誤的 public_key 導致問題..

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM