我正在尝试使用Docker容器中的gitlab CI / CD在我的gitlab项目中下载一个私有gitlab存储库软件包。
现在我遇到以下错误:
- 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: "Permission denied" when pulling private composer package
我的.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
我想念什么吗?
答案 0 :(得分:0)
我通过以下帖子解决了这个问题:https://stackoverflow.com/a/38570269/6385459 这是将公共SSH密钥作为部署密钥添加到所有私有依赖项中的部分。我输入了错误的public_key导致了问题。