Skip to content

Latest commit

 

History

History
54 lines (36 loc) · 1.2 KB

File metadata and controls

54 lines (36 loc) · 1.2 KB

setup-ssh-client

GitHub Action for setting up everything needed for connecting to a remote SSH server from the runner.

Warning

This action overwrites any existing SSH keys already saved in the ~/.ssh/id_rsa file.

Usage

jobs:

  do-the-thing:

    runs-on: ubuntu-latest

    steps:

      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Setup SSH client
        uses: tichopad/setup-ssh-client@v1
        with:
          ssh-key: ${{ secrets.SSH_KEY }}

      - name: Connect to SSH server
        run:  ssh -T -o StrictHostKeyChecking=no user@example.com 'echo "Hello, world!"'

If you want to avoid using the StrictHostKeyChecking=no option for better security, you can add the host key to the known hosts file by using the known-hosts input:

jobs:

  do-the-thing:

    runs-on: ubuntu-latest

    steps:

      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Setup SSH client
        uses: tichopad/setup-ssh-client@v1
        with:
          ssh-key: ${{ secrets.SSH_KEY }}
          known-hosts: ${{ secrets.KNOWN_HOSTS }}

      - name: Connect to SSH server
        run:  ssh -T user@example.com 'echo "Hello, world!"'