是Gitlab的新手,希望能在这里找到帮助。
我在GCP中运行了一个运行debian linux的虚拟机。 我正在使用Gitlab将更改推送到该VM。 对于先决条件,我生成了SSH密钥并添加到Gitlab。
这就是我的gitlab-ci.yml的样子
before_script:
- apt-get update -qq && apt-get install -y -qq sshpass
deploy_stage:
stage: deploy
environment: Staging
only:
- stage
script:
- ls
- sshpass -V
- export SSHPASS=$USER_PASS
- sshpass -e scp -o stricthostkeychecking=no -r . xxxxxx@xx.xxx.xx.xx:/datastore/test
但是当我合并更改时,我收到以下错误
管道作业的输出
$ ls
test
test2
test2-merge
$ sshpass -V
sshpass 1.06
(C) 2006-2011 Lingnu Open Source Consulting Ltd.
(C) 2015-2016 Shachar Shemesh
This program is free software, and can be distributed under the terms of the GPL
See the COPYING file for more information.
Using "assword" as the default password prompt indicator.
$ export SSHPASS=$USER_PASS
$ sshpass -e scp -o stricthostkeychecking=no -r . xxxxxx@xx.xxx.xx.xx:/datastore/test
***Warning: Permanently added 'xx.xxx.xx.xx' (ECDSA) to the list of known hosts.
Permission denied (publickey).***
lost connection
ERROR: Job failed: exit code 1
我错过了什么?
答案 0 :(得分:0)
仔细检查您是否拥有正确的ssh密钥并将其复制而不会删除任何字符。你可以用这些键手动连接吗?例如,将它们添加到本地.ssh / config并尝试ssh进入VM。