appleboy / scp-action

GitHub Action that copy files and artifacts via SSH.

Home Page:https://github.com/marketplace/actions/scp-command-to-transfer-files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tar: empty archive

frederickbeaulieu opened this issue Β· comments

commented

I get tar: empty archive when using the SCP action inside my Gitea Runner deployed in a docker container.

I tried to use folder structure used in this repository and the exact action definition, but no success.

image

image

I had the same problem.
My action runs well before. Recently, I re-created my repo. On my PC, I need to use ssh -o StrictHostKeyChecking=no VPSuser@MyIp to log in VPS.
And when I used the same configuration with Github Actions, it failed.

My config:

- name: Checkout
  uses: actions/checkout@v4
- name: Get changed files
  id: changed-files
  uses: tj-actions/changed-files@v35
  with:
    since_last_remote_commit: true
    separator: ","
- name: copy file to server
  uses: appleboy/scp-action@v0.1.7
  with:
    host: ${{ secrets.VPS_HOST }}
    username: ${{ secrets.VPS_USERNAME }}
    key: ${{ secrets.VPS_KEY }}
    # password: ${{ secrets.VPS_PASSWORD }}
    port: ${{ secrets.VPS_PORT }}
    source: "./html/*"
    target: /var/www/sub-domains/byya/

And when I use password, it return:

Run appleboy/scp-action@v0.1.7
...
drone-scp version: v1.6.14
tar all files into /tmp/ucUfUXaNUK.tar.gz
remote server os type is unix
scp file to server.
20[24](https://github.com/scillidan/BYYA-site/actions/runs/8122976226/job/22203873158#step:14:25)/03/02 14:53:48 error copy file to dest: ***, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
drone-scp error: error copy file to dest: ***, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain

When I use ssh-key, it return:

Run appleboy/scp-action@v0.1.7
...
drone-scp version: v1.6.14
tar all files into /tmp/ySUWcqCQnb.tar.gz
tar: empty archive
exit status 1

I've been using this action for about 4 years now - it's been helpful. I always, always, always struggle to get the source / target to work correctly as I'm never sure what directories should exist on the target, or what other rules are. The 'empty archive' message isn't helpful. Would it be possible to please improve the logging so that we know what the target directory is at runtime?

this really needs improving, its really misleading and a horrible error message, how could we improve the error message? are there are any issues open addressing this?

I am having the same problem, changing the tar_tmp_path is not registered either

I fixed this issue, the problem was with paths, if anyone else is having issues, Please make sure your paths are correct! the trailing and leading slashes matter. The action does not give clear error messages.

here are some examples of how I am using this action after fixing the issue:

- name: Copy the source to the server πŸ”
  uses: appleboy/scp-action@v0.1.7
  with:
    host: ${{ secrets.SSH_HOST }}
    username: ${{ secrets.SSH_USER }}
    key: ${{ secrets.SSH_KEY }}
    source: "."
    target: "~/src"
    overwrite: true
    strip_components: 1
- name: Copy dist content to server πŸ”
  uses: appleboy/scp-action@v0.1.7
  with:
    host: ${{ secrets.SSH_HOST }}
    username: ${{ secrets.SSH_USER }}
    key: ${{ secrets.SSH_KEY }}
    source: "./dist/wwwroot/*"
    target: "~/dist/"
    rm: true
    overwrite: true
    strip_components: 2

Notice the slashes, and the home directory!
make sure the directory you're SCP-ing to exists on the remote machine. Make sure you have correct permissions. If you still cant get it to work @ me. I will help you! Good luck