如何使用SSH键(从cPanel创建)连接到服务器?并最终提取一个新的副本并运行composer更新和数据库迁移(一个Symfony脚本)
我获得了拒绝权限的错误,所以我的ssh example.net.au ls -l /staging.example.net.au正在到达服务器,我只是不确定如何使用cPanel生成的密钥来进行身份验证。
bitbucket-pipelines.yml
# This is an example Starter pipeline configuration
# Use a skeleton to build, test and deploy using manual and parallel steps
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: atlassian/default-image:2
pipelines:
default:
- parallel:
- step:
name: 'Build and Test'
script:
- echo "Your build and test goes here..."
- step:
name: 'Lint'
script:
- echo "Your linting goes here..."
- step:
name: 'Security scan'
script:
- echo "Your security scan goes here..."
# The following deployment steps will be executed for each pipeline run. To configure your steps and conditionally deploy see https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/
- step:
name: 'Deployment to Staging'
deployment: staging
script:
- echo "Your deployment to staging script goes here..."
- echo $TESTVAR
- ssh example.net.au ls -l /staging.example.net.au
- step:
name: 'Deployment to Production'
deployment: production
trigger: 'manual'
script:
- echo "Your deployment to production script goes here..."发布于 2021-06-28 23:47:23
我认为你的SSL设置可能不正确。请尝试以下操作,以确保两台服务器相互信任:
==Part 1==
步骤1. SSH进入cPanel服务器(使用PuTTY或首选SSH客户端),并运行以下命令以生成新密钥:
ssh-keygen
eval $(ssh-agent)
ssh-add
cat ~/.ssh/id_rsa.pub步骤2.将生成的密钥从上面的“cat”命令复制到: Bitbucket ->您的回购->设置->访问键
==Part 2==
步骤3.在Bitbucket中,转到回购->设置-> SSH键->生成密钥
步骤4.回到cPanel服务器的SSH连接上,将上面步骤3中的密钥复制到授权密钥文件中。完成后保存:
nano ~/.ssh/authorized_keys右击粘贴(通常) CNRL+O以保存CNRL+X以退出
步骤5.在步骤3的同一个Bitbucket屏幕中,获取并添加主机的指纹。您需要在这里输入cPanel服务器的URL或IP地址。一些cPanels服务器使用非默认端口.如果端口22不是正确的端口,请确保指定如下所示:
example.com:2200
(端口443通常是为HTTPS保留的,它不太可能是SSH连接的正确端口。如果有疑问,请先尝试默认的22和常见的备选方案2200端口。)
如果您有任何问题,请告诉我,我很乐意进一步帮助您。
https://stackoverflow.com/questions/67631692
复制相似问题