bitbucket ci cd pipelines ssh连接失败

问题描述 投票:-1回答:1

ssh -i~ / home / devops / .ssh / authorized_keys [email protected]警告:无法访问身份文件/root/home/devops/.ssh/authorized_keys:没有此类文件或目录。由于stdin不是终端,因此不会分配伪终端。权限被拒绝(publickey,gssapi-keyex,gssapi-with-mic)。

我的authorized_keys位于同一位置,但它不显示此类文件或目录

我的.yml文件是

image: node:8.14.0
pipelines:
  default:
    - step:
        script:
          #- echo "Everything is awesome!"
          #- npm install 
          #- echo "Build files"
          #- echo "$(ls -la)"
          #- npm install -g @angular/[email protected]
          #- ng build -prod
          #- cd dist/ 
          #- echo "$(ls -la)"
          - echo "Connect to server"
          - ssh -i ~/home/kiran/.ssh/authorized_keys [email protected]
          - scp -r README.md [email protected]:/home/kiran/temp
bitbucket bitbucket-pipelines
1个回答
1
投票

我在这里看到了几件事。

  1. ~/home/kiran/.ssh/authorized_keys Docker镜像中不存在node:8.14.0文件。 (这是错误消息的主要部分 - No such file or directory。)
  2. authorized_keys是一个公钥列表。 ssh -i需要私钥。
  3. authorized_keys仅用于验证传入连接 - 如果新连接请求由对应于authorized_keys中的一个公钥的私钥签名,则连接被授权。您不能使用authorized_keys建立传出连接,此处的管道尝试建立传出连接。

您需要在管道中设置私钥,并将相应的公钥添加到远程系统上的authorized_keyshttps://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html在那里有一些指示。

© www.soinside.com 2019 - 2024. All rights reserved.