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

Error loading SSH key on self-hosted Windows runner #1397

Open
ivy-tru opened this issue Jun 30, 2023 · 2 comments
Open

Error loading SSH key on self-hosted Windows runner #1397

ivy-tru opened this issue Jun 30, 2023 · 2 comments

Comments

@ivy-tru
Copy link

ivy-tru commented Jun 30, 2023

Hello
I have an issue on checkout via SSH on a Windows self-hosted runner (Windows 2012 R2).

My action code looks like this:

      - name: Checkout
        uses: actions/checkout@v3
        with:
          repository: ***/script
          ssh-key: ${{ secrets.SSH_*** }}
          path: 'script'
          ref: ${{ inputs.script-branch }}     

I get these logs

2023-06-30T15:42:22.1865438Z ::group::Fetching the repository
2023-06-30T15:42:22.1866093Z ##[group]Fetching the repository
2023-06-30T15:42:22.1883054Z [command]"C:\Program Files\Git\cmd\git.exe" -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/develop*:refs/remotes/origin/develop* +refs/tags/develop*:refs/tags/develop*
2023-06-30T15:42:24.2119758Z Load key "C:\\github-actions-runner\\_work\\_temp/690271f6-12fc-44c5-8fc9-8049f21ed1b3": Permission denied
2023-06-30T15:42:24.2122709Z git@github.com: Permission denied (publickey).
2023-06-30T15:42:24.2136724Z ##[error]fatal: Could not read from remote repository.
2023-06-30T15:42:24.2138176Z 
2023-06-30T15:42:24.2138734Z Please make sure you have the correct access rights
2023-06-30T15:42:24.2139578Z and the repository exists.
2023-06-30T15:42:24.2187116Z The process 'C:\Program Files\Git\cmd\git.exe' failed with exit code 128

... and in post phase ...

2023-06-30T15:43:01.2873574Z ##[debug]File was unable to be removed Error: EPERM: operation not permitted, stat 'C:\github-actions-runner\_work\_temp\690271f6-12fc-44c5-8fc9-8049f21ed1b3'
2023-06-30T15:43:01.2876077Z ##[warning]Failed to remove SSH key 'C:\github-actions-runner\_work\_temp\690271f6-12fc-44c5-8fc9-8049f21ed1b3'
2023-06-30T15:43:01.2903495Z [command]"C:\Program Files\Git\cmd\git.exe" config --local --name-only --get-regexp core\.sshCommand

Same code works works without issues on:

  • GitHub hosted runner (windows-latest)
  • Self-hosted runner Windows 2012 R2 when runner has elevated privileges (running as administrator)
  • Self-hosted runner on Ubuntu

So I think my action configuration and my SSH configuration is good. It happens on two different Windows machines...

@radoslaw-wielonski-nc
Copy link

I have similiar problem on self hosted windows runner. Have you solved it @ivy-tru?

@ivy-tru
Copy link
Author

ivy-tru commented Jun 21, 2024

Hi @radoslaw-wielonski-nc
There are no news on this topic. We just configured the Actions Runner service to run as a privileged user account. This way it works fine. Maybe not best practice about security but only way we see so far.

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

2 participants