ssh-2
This commit is contained in:
parent
873c000060
commit
bb1998ea21
@ -10,18 +10,13 @@ jobs:
|
|||||||
ssh-test:
|
ssh-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 检查SSH密钥
|
- name: SSH 连接测试
|
||||||
run: |
|
uses: appleboy/ssh-action@master
|
||||||
if [ -z "${{ secrets.KEY }}" ]; then
|
with:
|
||||||
echo "SSH私钥未配置"
|
host: 120.27.198.238
|
||||||
exit 1
|
username: root
|
||||||
fi
|
password: Havocantelope420#
|
||||||
echo "SSH私钥已配置"
|
port: '22'
|
||||||
|
script: |
|
||||||
- name: 测试SSH连接
|
echo "Running command on remote server"
|
||||||
run: |
|
ls -lha
|
||||||
echo "${{ secrets.KEY }}" > ssh_key
|
|
||||||
chmod 600 ssh_key
|
|
||||||
ssh -o StrictHostKeyChecking=no \
|
|
||||||
-i ssh_key \
|
|
||||||
${{ secrets.USER }}@${{ secrets.HOST }} "echo 'SSH连接成功!'"
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user