When I connect to my server through my local computer I can successfully connect to Github using ssh.
I used this tutorial to setup the ssh keys.
However, when using Github actions I get this error:
err: git@github.com: Permission denied (publickey).
err: fatal: Could not read from remote repository.
err:
err: Please make sure you have the correct access rights
err: and the repository exists.
This is my Github actions YML:
name: CI App to DO
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
deploy-do:
runs-on: ubuntu-latest
steps:
- name: SSH to server and Deploy App
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd ~/app
git pull origin master
npm run build
pm2 restart next
When running ssh-add -l on the server through my local machine I get my key but when doing the same through the Github actions workflow I get:
The agent has no identities.
My server is hosted on a Digital Ocean Droplet using Ubuntu 20.04. As stated previously, this works great when connecting to my server through my local machine and doing the git pull there. I use MobaXterm for connecting to my droplet.
Edit: I am able to make this work when not using a passphrase.
In my local machine i'm using MobaXterm