I am trying to run github action to get something done on my ec2 instance when something is pushed on the repo automatically
name: CI/CD Pipeline
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
awk
Copy
steps:
- name: Deploy to EC2
env:
HOST: ${{ secrets.EC2_HOST }}
USERNAME: ${{ secrets.EC2_USERNAME }}
KEY_FILE: ${{ secrets.EC2_KEY_FILE }}
run: |
sudo echo $KEY_FILE > /tmp/ec2-key.pem
sudo chmod 400 /tmp/ec2-key.pem
sudo ssh -o StrictHostKeyChecking=no $USERNAME@$HOST uptime # added to resolve host key verification failed
sudo ssh -i /tmp/ec2-key.pem $USERNAME@$HOST "mkdir sadsad"
But I fail into that issue:
Warning: Permanently added '***' (ED25519) to the list of known hosts.
***@***: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
Any idea? why does it happen: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).