Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github actions ssh raises "Connection refused" while I can connect manually

I am using GitHub actions for ssh, and when I use it it says: dial tcp ***: connect: connection refused

But when I manually ssh into the VM, it works.

Could you help me w it?

The actions script:

jobs:
  build:
    name: Compile and deploy application

    runs-on: ubuntu-latest

    steps:
      - name: executing remote ssh commands using password
        uses: appleboy/ssh-action@master
        with:
          host: ${{ secrets.SSH_HOST }}
          username: ${{ secrets.SSH_USERNAME }}
          password: ${{ secrets.SSH_PASSWORD }}
          port: ${{ secrets.SSH_PORT }}
          script: echo test

I am trying to automate deploying my app to a vm, but I am not able to ssh into the vm using github actions.

like image 435
Rushil Gupta Avatar asked Oct 20 '25 10:10

Rushil Gupta


1 Answers

But when I manually ssh into the VM, it works.

It depends from where you are doing this manual test.

I would add a step in your GitHub Action to run

curl -v telnet://${{ secrets.SSH_HOST }}:${{ secrets.SSH_PORT }}

That would check if the network route is opened/accessible from the GitHub runner, or if it is closed.

like image 133
VonC Avatar answered Oct 22 '25 05:10

VonC