Static Code (HTML) Workflow: Host key verification failed #137373
Replies: 4 comments 1 reply
-
The error code suggest that SSH is unable to verify the authenticity of the remote DigitalOcean server, which usually means that the host key for your server is not recognized by your AWS EC2 instance. To resolve this issue you could add the server's host key to You can solve this by:
name: Sync files to DigitalOcean server
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Add server to known_hosts
run: ssh-keyscan -H 00.000.000.0 >> ~/.ssh/known_hosts
- name: Sync files to DigitalOcean server
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
rsync -avz --delete --exclude='.git' ./ root@00.000.000.0:/var/www/html/example.com
Let me know if that solved it. |
Beta Was this translation helpful? Give feedback.
-
Thanks @gabrielfrimodig, I think you have me on the right track. After following your instructions, I recieved the following error: /home/runner/work/_temp/8a016819-f960-4802-9279-1a689f812ddf.sh: line 1: /home/runner/.ssh/known_hosts: No such file or directory Where did runner come from in the known_hosts path? This is why an error appeared, correct? |
Beta Was this translation helpful? Give feedback.
-
@gabrielfrimodig thanks for following-up. I'm confused now, because there was always an ssh directory (see attached). I guess I'm still not understanding the "runner" concept. The known_hosts file exists and was updated, but still get the error. I feel like I'm close though. |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
I am using Secrets for the first time. My goal is to push code from my AWS EC2 instance which is my development serer, to my Github repo then automatically push the code to my production server, which is a Digital Ocean droplet (lLinux Ubuntu). I added my public key to the production/Digital Ocean server and the private key is on the AWS EC2 instance. I also added the contents of the public key as a Repository secret. With this set up, the workflow is NOT functioning properly, The error is "Host key verification failed" , and it happens here in my static.yml file:
name: Sync files to DigitalOcean server
run: |
rsync -avz --delete --exclude='.git' ./ root@00.000.000.0:/var/www/html/example.com
Where am I going wrong? Am I missing a key in this design?
Beta Was this translation helpful? Give feedback.
All reactions