ssh-key-action
ssh-key-action copied to clipboard
Host key verification failed.
Hey all,
I have this problem as others.
Run if [ "refs/heads/4-implement-workflows" = "refs/heads/main" ]; then
if [ "refs/heads/4-implement-workflows" = "refs/heads/main" ]; then
rsync -avz dist/ ***@***:***
else
rsync -avz dist/ ***@***:***
fi
shell: /usr/bin/bash -e {0}
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(231) [sender=3.2.7]
Error: Process completed with exit code 255.
This is my workflow config
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
name: github_rsa
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
config: |
Host ${{ secrets.SSH_HOST }}
HostName ${{ secrets.SSH_HOST }}
User ${{ secrets.SSH_USER }}
IdentityFile ~/.ssh/github_rsa
Port ${{ secrets.SSH_PORT }}
- name: Deploy to VPS
run: |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
rsync -avz dist/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_PRODUCTION_PATH }}
else
rsync -avz dist/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_STAGING_PATH }}
fi
My secrets list in github
Considerations:
- I generated the
SSH_KNOWN_HOSTSwith the commandssh-keyscan -p PORT IP_ADDRESSagainst my remote host. SSH_PRIVATE_KEYis obviously the private key installed on the remote host (IdentityFile in config).
Am I missing something?