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

Windows: unable to clone, with error message ssh: Could not resolve hostname key-<SHA>.github.com: Name or service not known #230

Open
DilumAluthge opened this issue Nov 14, 2024 · 0 comments

Comments

@DilumAluthge
Copy link
Contributor

DilumAluthge commented Nov 14, 2024

I see a few open issues that look similar to this, but not exactly the same, so I figured I'd open a new issue. Feel free to close if this is a duplicate.

For example, this might be a duplicate of #148.

Version info

I am able to reproduce this bug using version v0.9.0 (dc588b6) of this action.

Description of the bug

On Windows, I am unable to clone, with the error message looking something like this:

ssh: Could not resolve hostname key-<SHA>.github.com: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I've only encountered this bug on Windows. I have not seen this bug on Linux or macOS.

I do not have any Git submodules.

Workaround

I'm able to resolve the bug by setting the GIT_SSH_COMMAND environment variable as follows:

- name: Set GIT_SSH_COMMAND on Windows
  if: runner.os == 'Windows'
  shell: bash
  run: |
    echo "GIT_SSH_COMMAND=ssh -F /c/Users/MY_USERNAME/.ssh/config -o \"UserKnownHostsFile /c/Users/MY_USERNAME/.ssh/known_hosts\"" >> "${GITHUB_ENV:?}"

Replace /c/Users/MY_USERNAME/ with the correct home directory. On GitHub-hosted Windows runners, this will probably be /c/Users/runneradmin. For self-hosted Windows runners, this will depend on your CI setup.

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

1 participant