gpt4 book ai didi

ssh - Bitbucket 管道 - 如何设置 ssh

转载 作者:行者123 更新时间:2023-12-02 14:17:53 25 4
gpt4 key购买 nike

当我的管道运行时,我收到以下错误:

debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/config
debug1: key_load_private_type: incorrect passphrase supplied to decrypt private key
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
lost connection

这是我的 .yml 文件:
image: maven:3.3.9

pipelines:
default:
- step:
caches:
- maven
name: Build
script: # Modify the commands below to build your repository.
- echo "Build Start"
- mvn package
- echo $BUILD_DIR
- mv target/**.jar target/transpoDirect.jar
artifacts:
- target/**.jar
- step:
name: Deploy
image: maven:3.3.9
script:
- ls -la .
- scp -i ~/.ssh/config -P 7822 -v -o StrictHostKeyChecking=no target/*.jar root@$hostName:/var/transpoDirect/.
- ssh -p 7822 -i ~/.ssh/config -v -o StrictHostKeyChecking=no root@$hostName sudo service transpoDirect restart

我试过的是 chmod ~/.ssh 文件夹和文件到 777

hostName 变量在存储库的设置中设置。

重新生成 key 。粘贴在远程服务器的 authorize_keys 文件中,但我仍然收到相同的错误

授权 key 的位置:

enter image description here

==================================================== ===============

这是有效的:
  • 从 bitbucket 的管道中删除了 SSH key 。
  • 使用以下命令在远程服务器上生成 SSH key :ssh-keygen
  • 上述命令使用默认值,不设置密码。
  • 生成 key 的默认位置是:/root/.ssh
  • .ssh 文件夹被隐藏。使用 winSCP 您可以取消隐藏隐藏文件夹。
  • 从远程服务器复制 id_rsa.pub 的内容并粘贴到 bitbucket 的 SSH 中。
  • 在/root/.ssh
  • 中使用 id_rsa.pub 的内容创建了授权 key
  • 从远程服务器复制 id_rsa 的内容并粘贴到 bitbucket 的 SSH 中。
  • 这会将 jar 复制到远程服务器:
  • scp -i/root/.ssh -4 -P 7822 -v -o StrictHostKeyChecking=no target/*.jar root@$hostName:/var/transpoDirect/。
  • 这将重新启动服务,如下所述:https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html
  • ssh -4 -p 7822 -i/root/.ssh -v -o StrictHostKeyChecking=no root@$hostName sudo service transpoDirect restart
  • 最佳答案

    这是有效的:

  • 从 bitbucket 的管道中删除了 SSH key 。
  • 使用以下命令在远程服务器上生成 SSH key :ssh-keygen
  • 上述命令使用默认值,不设置密码。
  • 生成 key 的默认位置是:/root/.ssh
  • .ssh 文件夹被隐藏。使用 winSCP 您可以取消隐藏隐藏文件夹。
  • 从远程服务器复制 id_rsa.pub 的内容并粘贴到 bitbucket 的 SSH 中。
  • 在/root/.ssh
  • 中使用 id_rsa.pub 的内容创建了授权 key
  • 从远程服务器复制 id_rsa 的内容并粘贴到 bitbucket 的 SSH 中。
  • 这会将 jar 复制到远程服务器:

    scp -i/root/.ssh -4 -P 7822 -v -o StrictHostKeyChecking=no target/*.jar root@$hostName:/var/transpoDirect/。
  • 这将重新启动服务,如下所述:https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html

    ssh -4 -p 7822 -i/root/.ssh -v -o StrictHostKeyChecking=no root@$hostName sudo service transpoDirect restart


  • 进一步说明:
    该文件应放在 $HOME/.ssh/authorized_keys
    您可以通过 eval echo "$HOME"检查 $HOME 的位置
    此外,需要了解的是 id_rsa 是私有(private)文件 - 这意味着该文件不被共享,但 id_rsa.pub 是公共(public)文件,这是要提供给其他服务器的文件。

    关于ssh - Bitbucket 管道 - 如何设置 ssh,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54141498/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com