ssh-deploy icon indicating copy to clipboard operation
ssh-deploy copied to clipboard

Deployment failure

Open Jasoni996 opened this issue 3 years ago • 4 comments

My purpose is to hope Github Actions can deploy Hexo blog into Ali Cloud server, according to the documentation my actions file is as follows:

name: Aliyun Server CI

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Install Node.js
      uses: actions/setup-node@v1
      with:
        node-version: '16.x'
    - name: Install npm dependencies
      run: npm install
    - name: Run build task
      run: npm run build --if-present
    - name: Deploy to Server
      uses: easingthemes/ssh-deploy@main
      env:
          SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
          ARGS: "-rltgoDzvO --delete"
          SOURCE: "dist/"
          REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
          REMOTE_USER: ${{ secrets.REMOTE_USER }}
          EXCLUDE: "/dist/, /node_modules/"

And added three Actions secrets to the GitHub repository, their configuration is as follows:

name value
SERVER_SSH_KEY Use ssh-keygen -m PEM -t rsa -b 4096 to generate secrets on the server and paste the id_rsa into github Actions. However, there was no authorized_keys file in my server's.ssh directory, so I created a new authorized_keys file in the .ssh directory and pasted the id_rsa.pub file contents into authorized_keys
REMOTE_HOST My website uses CDN service, and HERE I fill in coder-jason.cn
RREMOTE_USER It's a random nickname I made up: jason

Github Actions log is as follows:

⚠️ [Rsync] error:  rsync exited with code 255
⚠️ [Rsync] stderr:  ssh: connect to host *** port [22](https://github.com/PDPENG/MyBlog/runs/6587206440?check_suite_focus=true#step:6:23): Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c([23](https://github.com/PDPENG/MyBlog/runs/6587206440?check_suite_focus=true#step:6:24)5) [sender=3.1.3]

⚠️ [Rsync] stdout:  
⚠️ [Rsync] cmd:  rsync /home/runner/work/MyBlog/MyBlog/dist/ ***@***:/home/REMOTE_USER/ --rsh "ssh -p 22 -i /home/runner/.ssh/deploy_key -o StrictHostKeyChecking=no" --recursive --exclude= -rltgoDzvO --delete
 1: 0xa1a640 node::Abort() [/home/runner/runners/2.[29](https://github.com/PDPENG/MyBlog/runs/6587206440?check_suite_focus=true#step:6:30)1.1/externals/node12/bin/node]
 2: 0xa90649  [/home/runner/runners/2.291.1/externals/node12/bin/node]
 3: 0xc06599  [/home/runner/runners/2.291.1/externals/node12/bin/node]
 4: 0xc08387 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/home/runner/runners/2.291.1/externals/node12/bin/node]
 5: 0x140dd19  [/home/runner/runners/2.291.1/externals/node12/bin/node]

I look forward to your reply, thank you!

Jasoni996 avatar May 25 '22 07:05 Jasoni996

I have the same problem, unable to complete the deployment, help me !

PDPENG avatar May 25 '22 07:05 PDPENG

Same problem.

victorcyou avatar Jun 07 '22 20:06 victorcyou

I have encountered the same problem. You can check whether the SSH key is correct and try to regenerate the SSH key

zhangjichengcc avatar Jun 22 '22 08:06 zhangjichengcc

Thanks

PDPENG avatar Jun 24 '22 00:06 PDPENG

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Jan 01 '23 02:01 github-actions[bot]

Use SCRIPT_BEFORE: ls env variable to test SSH connection. This will force known_hosts update and can help in connections issues.

  1. SCRIPT_BEFORE (optional, default '') Script to run on host machine before rsync. Single line or multiline commands. Execution is preformed by storing commands in .sh file and executing it via .bash over ssh

easingthemes avatar Jan 03 '23 03:01 easingthemes

Please reopen issue if it's still valid.

easingthemes avatar Jan 03 '23 03:01 easingthemes