【发布时间】:2019-06-06 01:54:08
【问题描述】:
当我的管道运行时,我收到以下错误:
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 变量在存储库的设置中设置。
重新生成密钥。粘贴在远程服务器的authorize_keys文件中,但我仍然得到同样的错误
authorized_keys 的位置:
================================================ ==================
这是有效的:
- 从 bitbucket 的管道中删除了 SSH 密钥。
- 使用 ssh-keygen 在远程服务器上生成 SSH 密钥
- 上述命令使用默认值,不设置密码。
- 生成密钥的默认位置是:/root/.ssh
- .ssh 文件夹被隐藏。使用 winSCP,您可以取消隐藏隐藏文件夹。
- 从远程服务器复制 id_rsa.pub 的内容并粘贴到 bitbucket 的 SSH 中。
- 使用 /root/.ssh 中的 id_rsa.pub 的内容创建了 authorized_keys
- 从远程服务器复制 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
【问题讨论】:
标签: ssh bitbucket bitbucket-pipelines