Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh-key didn't checkout with ssh url #291

Open
lunawen opened this issue Jun 28, 2020 · 7 comments
Open

ssh-key didn't checkout with ssh url #291

lunawen opened this issue Jun 28, 2020 · 7 comments

Comments

@lunawen
Copy link

lunawen commented Jun 28, 2020

Hi,
I've got a simple automated workflow for my static blog, here's my config:

- name: Checkout Repo
        uses: actions/checkout@v2
        with:
          ssh-key: ${{ secrets.DEPLOY_KEY }}
  • I've got DEPLOY_KEY in my repo's secret,
  • the public key is added to my user settings.
  • The workflow can run successful

except when I use git remote get-url origin, I find it is still an HTTPS url.
I would like to have ssh url, is there anything I missed in this config?

image

Thanks for your help.

Luna

@ericsciple
Copy link
Contributor

Is it a fork PR? Secrets aren't available during fork PRs.

@lunawen
Copy link
Author

lunawen commented Jun 29, 2020

Hi Eric, thanks for your reply. It's not a fork PR, it's my private repo.

But today when I check again, it shows the remote url is ssh (hurray!)

The problem now is that, when I manually pull the repo in the remote server, it gives me error.

image

Any idea why is this happening?

@ericsciple
Copy link
Contributor

I haven't seen that error before. Are you using a job container?

@lunawen
Copy link
Author

lunawen commented Jul 1, 2020

Hi Eric,

Nope, here's my full workflow file, it is a basic one.

name: Deploy Site on push

on:
  push:
    branches:
      - master 

jobs:
  deploy: 
    runs-on: ubuntu-latest 

    steps: 
      - name: Checkout Repo 
        uses: actions/checkout@v2 
        with:
          ssh-key: ${{ secrets.DEPLOY_KEY }}

      - name: Deploy to Server 
        uses: AEnterprise/rsync-deploy@v1.0 
        env:
          DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} 
          ARGS: -avz --delete 
          SERVER_PORT: "22" 
          FOLDER: ./ 
          SERVER_IP: ${{ secrets.SSH_HOST }} 
          USERNAME: ${{ secrets.SSH_USERNAME }} 
          SERVER_DESTINATION: /var/www/xxx/ 

So this ssh error is not expected, right? As the workflow can use it without issue, it only happens when I log in the server and do it manually. Maybe something to do with my user role?

@ericsciple
Copy link
Contributor

oh i see now.

No RSA host is known for github.com and you have requested strict checking

It looks like you might need to add github.com to your known_hosts file (for example) or turn of strict host checking

@awhitford
Copy link

Based on this:

    # Known hosts in addition to the user and global host key database. The public SSH
    # keys for a host may be obtained using the utility `ssh-keyscan`. For example,
    # `ssh-keyscan github.com`. The public key for github.com is always implicitly
    # added.
    ssh-known-hosts: ''

I would think that adding github.com as a known host should not be necessary.

@BondLi1
Copy link

BondLi1 commented Jun 10, 2022

image

when I ./config.cmd --name $runner_name --unattended --replace --runasservice in windows server,then I will get above error when run checkout action when use ssh way to clone code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants