i have an issue with my github action and i can't connect with ssh i did this :
Create an ssh key with user adam
Copy the public key into /root/.ssh/authorized_keys
Create a secret in github with the public key
Create a script.sh into /home/adam/
chmod 600 .ssh directory
But i got this error :
Run ssh -o StrictHostKeyChecking=no
Warning: Identity file /home/adam/.ssh/id_rsa not accessible: No such file or directory.
Warning: Permanently added 'my Ip' (ED25519) to the list of known hosts.
adam@my Ip: Permission denied (publickey,password,keyboard-interactive).
Error: Process completed with exit code 255.
This is my code :
name: Run script on VPS
on:
push:
branches: [master]
jobs:
run-script:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run script
env:
SSH_PRIVATE_KEY: ${{ secrets.VPS_SSH_PUBLIC_KEY }}
run: |
ssh -o StrictHostKeyChecking=no \
-o PasswordAuthentication=no \
-i /home/adam/.ssh/id_rsa \
adam@myip \
"bash /home/adam/script.sh"
Can someone help me fix this ?
CASignatureAlgorithms +ssh-rsa
thank you for your answers I don't know exactly what was the issue but i think it was related with the ssh key
I fixed my code by using password that is store in secret of github instead of ssh key
name: Deploy 🚀
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: '16.x'
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- name: SSH Deploy
run: |
sshpass -p ${{ secrets.PSWD }} ssh -o StrictHostKeyChecking=no -p 22 ${{ secrets.USER}}@${{ secrets.VPS_IP }} 'cd /home/adam && ./deploy.sh'
env:
SSHPASS: ${{ secrets.PSWD }}