【发布时间】:2018-07-15 19:33:16
【问题描述】:
让我的 Google 服务帐户从 bitbucket 管道通过 ssh 连接到我们的 Compute Engine 实例,我很费时间。
Script:
gcloud compute ssh instance1 --zone us-central1-a --quiet --verbosity=info --command="gracefully shutdown processes" && \
gcloud compute scp ~/ instance1:~/ --zone us-central1-a --quiet --recurse --compress && \
gcloud compute ssh instance1 --zone us-central1-a --quiet --verbosity=info --command="start the services"
ERROR: (gcloud.compute.ssh) Could not SSH into the instance. It is possible that your SSH key has not propagated to the instance yet. Try running this command again. If you still cannot connect, verify that the firewall and instance are set to accept ssh traffic.
Permission denied (publickey).
lost connection
ERROR: (gcloud.compute.scp) [/usr/bin/scp] exited with return code [1].
我什至尝试过不使用 gcloud 的老式 SSH 方式。我使用metadata 将公钥添加到实例中。我可以在我的本地机器上通过 SSH 登录,但是使用 bitbucket 管道时,我收到了权限被拒绝错误。
script:
- echo $PRIVATE_SSH_KEY > ./ssh_key
- chmod 400 ssh_key
- ssh -t -t -i ssh_key bitbucket-service-account@<IP>
Permission denied (publickey).
我可能做错了什么?
【问题讨论】:
标签: ssh google-compute-engine bitbucket-pipelines