GitHub Actions scenarios to deploy with 'permission denied' despite correct SSH setup
I'm trying to debug I keep running into This might be a silly question, but I'm trying to set up a GitHub Action to deploy my Node.js application to a remote server using SSH... However, I'm running into a 'permission denied' behavior during the deployment step, even though I've followed the documentation for setting up SSH keys correctly. Here's the relevant part of my `.github/workflows/deploy.yml` file: ```yaml name: Deploy to Server on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Set up SSH uses: webfactory/ssh-agent@v0.5.3 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Deploy run: | ssh -o StrictHostKeyChecking=no user@myserver.com "cd /path/to/app && git pull && npm install && npm run build" ``` I've ensured that my `SSH_PRIVATE_KEY` secret is set up correctly in the repository settings, and I've also added the public key to the `~/.ssh/authorized_keys` on the server. However, when the action runs, I see the following behavior in the logs: ``` fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. ``` I've double-checked the permissions on the server, and the user has permission to access the repository. I also tried running the SSH command manually from my local machine, and it works perfectly. The question only seems to occur in the GitHub Actions environment. Is there something I might be missing in the configuration, or is there a specific setting in GitHub Actions that could be causing this scenario? What's the best practice here? I'm working on a CLI tool that needs to handle this. Is there a better approach? The project is a REST API built with Yaml. Any ideas what could be causing this? What's the best practice here?