我正在通过GitLab-CI在CI / CD上下文中使用 gradle-release 插件。
我已经在GitLab中设置了一个公共私钥,以允许我的管道在回购中推送内容,但是我想我有一个问题,如何将SSH信息传递给gradle进程。
在我的管道脚本中,我有一个before_script
,并且有
- eval $(ssh-agent -s)
- bash -c 'ssh-add <(echo "${MY_SSH_PRIVATE_KEY}")'
MY_SSH_PRIVATE_KEY
存储在GitLab CI变量中。
然后我将ssh样式设置为git repo的远程URL
git remote set-url origin git@${remoteUrl}
我结帐了我的分支
git checkout -B ${CI_COMMIT_REF_NAME} ${CI_COMMIT_SHA}
然后我要求插件
./gradlew release --info -Prelease.useAutomaticVersion=true
我在插件过程中遇到问题
> Failed to run [git remote update] - [Fetching origin ][Host key
> verification failed. fatal: Could not read from remote repository.
>
> Please make sure you have the correct access rights and the repository
> exists. error: Could not fetch origin ]
您对修复方法有想法吗?