I have a project that is successfully built but i cannot get github action to rsync to the droplet web folder. I have entered the private key (with the begin and end comment that surround the hash of the private key), i have enabled with ufw the SSH at port 22, somehow i get this error message: Run rsync -avz ./ @:/var/www/html
rsync -avz ./ ***@***:/var/www/html
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.
Here is the github action: name: Build and Deploy
on: push: branches: [ main ] workflow_dispatch:
jobs: build: runs-on: ubuntu-latest
env:
NODE_ENV: production
COMPOSER_NO_DEV: 1
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node packages
run: npm install
- name: Build assets
run: npm run build
- name: Setup PHP
uses: "shivammathur/setup-php@v2"
with:
php-version: 8.3
- name: Install Composer packages
uses: ramsey/composer-install@v3
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: AuthenticatorProWebsite
path: |
application
vendor
public
deploy: runs-on: ubuntu-latest needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: AuthenticatorProWebsite
- name: Prepare environment file
run: |
printf %s "${{ secrets.ENV_FILE }}" > .env
- name: Deploy with rsync
run: rsync -avz ./ ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:/var/www/html
thank you in advance for your help
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hi there,
As far as I can tell, your workflow setup looks good. You’ve done well with the build process!
The error message shows there’s a problem with SSH key authentication so in general there are a few common things that you should start by checking:
Before running rsync, add these steps to your workflow:
Make sure to add your private key as
SERVER_SSH_KEY
in your repository secrets.Change your rsync command like this:
The
-o StrictHostKeyChecking=no
option helps avoid the host key verification.Check that
DEPLOY_USER
,DEPLOY_HOST
, andSERVER_SSH_KEY
are set correctly in your GitHub repository secrets.If you still have problems, add more details to your SSH connection for debugging:
This will give you more information about the SSH connection process.
Try these suggestions and let me know the results. If you still have problems, feel free to share more details! Good luck with your deployment!
- Bobby