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

Error "can't connect without a private SSH key or password"

saberkovich opened this issue · comments

I ran into the error I described in the title, tried to reinstall the server but nothing helps. Surprisingly, yesterday everything was working fine, today the error is already popping up.

My file:

name: Deploy

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest
    environment: main

    steps:
    - uses: actions/checkout@v1

    - name: Copy repository contents via scp
      uses: appleboy/scp-action@master
      env:
        HOST: ${{ secrets.HOST }}
        USERNAME: ${{ secrets.USERNAME }}
        PORT: ${{ secrets.PORT }}
        KEY: ${{ secrets.SSHKEY }}
      with:
        source: "."
        target: "/servers_folder/bfg-bot/"

    - name: Executing remote command
      uses: appleboy/ssh-action@master
      with:
        HOST: ${{ secrets.HOST }}
        USERNAME: ${{ secrets.USERNAME }}
        PORT: ${{ secrets.PORT }}
        KEY: ${{ secrets.SSHKEY }}
        script: reboot

Error:

Error: can't connect without a private SSH key or password

I know that already wrote on this error, it was specified that you need to add:
environment: main
That didn't work.

Switch from using scp-action@master to v0.1.4, this fixed the issue for me

I have the same issue as described when using the @master version. Using @v0.1.4 as @kherchel mentioned fixes the issue for now.

Now I see another error:

ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

Switch from using scp-action@master to v0.1.4, this fixed the issue for me

This solution worked.

Note: Set version v0.1.4 only in file transfer settings, no need in Executing remote command.

@saberkovich Please update your config. Don't use environment variable.

Find

    - name: Copy repository contents via scp
      uses: appleboy/scp-action@master
      env:
        HOST: ${{ secrets.HOST }}
        USERNAME: ${{ secrets.USERNAME }}
        PORT: ${{ secrets.PORT }}
        KEY: ${{ secrets.SSHKEY }}
      with:
        source: "."
        target: "/servers_folder/bfg-bot/"

Replace

    - name: Copy repository contents via scp
      uses: appleboy/scp-action@master
      with:
        host: ${{ secrets.HOST }}
        username: ${{ secrets.USERNAME }}
        port: ${{ secrets.PORT }}
        key: ${{ secrets.SSHKEY }}
        source: "."
        target: "/servers_folder/bfg-bot/"

@appleboy Thanks a lot problem solved

Thanks @appleboy, that did the trick.

commented

@saberkovich Please update your config. Don't use environment variable.

Find

    - name: Copy repository contents via scp
      uses: appleboy/scp-action@master
      env:
        HOST: ${{ secrets.HOST }}
        USERNAME: ${{ secrets.USERNAME }}
        PORT: ${{ secrets.PORT }}
        KEY: ${{ secrets.SSHKEY }}
      with:
        source: "."
        target: "/servers_folder/bfg-bot/"

Replace

    - name: Copy repository contents via scp
      uses: appleboy/scp-action@master
      with:
        host: ${{ secrets.HOST }}
        username: ${{ secrets.USERNAME }}
        port: ${{ secrets.PORT }}
        key: ${{ secrets.SSHKEY }}
        source: "."
        target: "/servers_folder/bfg-bot/"

Thank you for the support @appleboy , we had this issue as well. Just asking out of curiosity, were there any internal changes in the current release (v0.1.9) that could have affected this behavior? It was working for us until a couple of days ago.

Error: docker: command not found

Getting this error when using above code.

commented

I fixed it by removing the PORT.