easingthemes / ssh-deploy

GitHub Action for deploying code via rsync over ssh. (with NodeJS)
MIT License
1.19k stars 146 forks source link

Deploy outside home directory #152

Closed TavioBRMG closed 1 year ago

TavioBRMG commented 1 year ago

I need to upload the files to "var/www/html/". The script response is always:

rsync: [Receiver] mkdir "/home/***/var/www/html" failed: No such file or directory (2) rsync error: error in file IO (code 11) at main.c(791) [Receiver=3.2.7]

Triloworld commented 1 year ago

Use slash for absolute url: "/var/www/html/" You use relative path to home. By default directory after connection is the first part of url and join with the provided in script. This issue isn't connected to the tool so I suggest close issue. If you like better help then provide example of script setup

TavioBRMG commented 1 year ago

Thank you for your help. After a few hours racking my brain, I was able to resolve it by simply removing the "source" and leaving only the destination to "/var/www/html/". I needed to grant permissions to the directory (chmod 777) and it worked perfectly!!

name: Push-to-EC2
on:
  push:
    branches:
      - main
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@main
      - name: Deploy
        uses: easingthemes/ssh-deploy@main
        env:
          SSH_PRIVATE_KEY: ${{secrets.SERVER_SSH_KEY}}
          ARGS: "-rlgoDzvc -i --delete"
          REMOTE_HOST: ${{secrets.REMOTE_HOST}}
          REMOTE_USER: ${{secrets.REMOTE_USER}}
          TARGET: ${{secrets.REMOTE_TARGET}}