英文:
Suddenly can't connect without a private SSH key or password in GitHub actions
问题
I am using the continuous deployment by GitHub actions for 1 year or more everything was okay until yesterday when I pushed my updates I found an error in GitHub actions with this message:
> can't connect without a private SSH key or password
This is my yml code
jobs:
build:
runs-on: ubuntu-latest
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: "/home/ubuntu/dev-folder"
- name: Executing remote command
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
PORT: ${{ secrets.PORT }}
KEY: ${{ secrets.SSHKEY }}
command_timeout: 10m
script: cd dev-folder;
mvn package install
I didn't change anything in the yml file
Did GitHub change anything on its policy?
I searched and I didn't find anything to solve my problem
英文:
I am using the continuous deployment by GitHub actions for 1 year or more everything was okay until yesterday when I pushed my updates I found an error in GitHub actions with this message:
> can't connect without a private SSH key or password
This is my yml code
jobs:
build:
runs-on: ubuntu-latest
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: "/home/ubuntu/dev-folder"
- name: Executing remote command
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
PORT: ${{ secrets.PORT }}
KEY: ${{ secrets.SSHKEY }}
command_timeout: 10m
script: cd dev-folder;
mvn package install
I didn't change anything in the yml file
Did GitHub change anything on its policy?
I searched and I didn't find anything to solve my problem
答案1
得分: 5
Change
env:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT}}
with:
source: ''.'
target: ${{ secrets.PATH }}
to
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT}}
source: ''.'
target: ${{ secrets.PATH }}
英文:
I finally found the solution here: https://github.com/appleboy/scp-action/issues/113
Change
env:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT}}
with:
source: '.'
target: ${{ secrets.PATH }}
to
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT}}
source: '.'
target: ${{ secrets.PATH }}
答案2
得分: 1
我不熟悉那两个苹果男孩的操作,但快速查看项目后,他们最近发布了一个基础的Docker镜像,改变了环境变量的使用方式:
https://github.com/appleboy/drone-ssh/pull/252
在需要时修改EnvVars切片以包含INPUT_前缀
...
此外,您正在使用一个非常旧的/过时的actions/checkout@v1
版本。
我强烈建议更新您的配置以处理最新版本。
英文:
I'm not familiar with those two appleboy actions but taking a quick look at the projects, there was a recent release of their base docker image that changes how env vars are getting used:
https://github.com/appleboy/drone-ssh/pull/252
> Modify the EnvVars slice to include INPUT_ prefix when needed
>
> ...
Additionally, you're using a very old / outdated version of the actions/checkout@v1
I'd strongly recommend updating your config to handle the latest versions.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论