Open Robert-DEMCON opened 7 months ago
It's because of recursive submodules, see https://github.com/webfactory/ssh-agent/issues/130#issuecomment-1284043999
The workaround is to use the checkout action, init submodules manually, use this action, clone submodules manually.
I also having the same issue on Windows without submodules: true
on actions/checkout
after upgraded from v0.7.0
to v0.9.0
. It is working fine on Linux. My Windows workflow:
name: Development Build
on:
push:
branches:
- dev
pull_request:
branches:
- dev
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
concurrency: ${{ github.ref }}
permissions:
contents: read
id-token: write
jobs:
windows:
name: Build (Windows)
runs-on: windows-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up SSH agent
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.REDACED }}
The error:
Updating git repository `ssh://git@github.com/REDACED/REDACED.git`
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
error: failed to get `REDACED` as a dependency of package `REDACED v0.1.0 (D:\a\REDACED\REDACED\REDACED\REDACED)`
Caused by:
failed to load source for dependency `REDACED`
Caused by:
Unable to update ssh://git@github.com/REDACED/REDACED.git#aa65b327
Caused by:
failed to clone into: C:\Users\runneradmin\.cargo\git\db\REDACED-aaa97381c1f720a7
Caused by:
process didn't exit successfully: `git fetch --tags --force --update-head-ok ssh://git@github.com/REDACED/REDACED.git +refs/heads/*:refs/remotes/origin/* +HEAD:refs/remotes/origin/HEAD` (exit code: 128)
Error: Process completed with exit code 1.
@sykhro thanks for your suggestion. It's still not working for me on Windows though. I now have the following workflow (again some bits are redacted):
jobs:
build:
name: Pytest ${{ matrix.python-version }}, ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest"]
python-version: ["3.9", "3.10", "3.11"]
include:
- os: "windows-latest"
python-version: "3.11"
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: Place SSH private key to grant access to other repos
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.PRIVATE_KEY_FOR_PRIVATE_REPO }}
- name: Get submodules
run: |
git submodule init
git submodule update
(Same results with checkout@v3 and ssh-agent@v0.8.)
Looks like it's the same problem as @ultimaweapon
EDIT: replacing git submodule ...
with cd <submodule> && git clone <url> .
also fails on Windows with the same error as above.
We have the same issue, changing ssh-agent
version from 0.9.0
to 0.6.0
helps. Magically, if you change it back in the same PR to 0.9.0
– then it still works, but start failing on new PRs.
I was reading the code, and i think the problem is the "homeSsh" variable which have the the root concat with /.ssh, but on windows path use "\" instead of "/" so the ssh-agent are not finding the keys
My Github action succeeds on Linux but fails on Windows the error:
Full log:
> Run actions/checkout@v3 > Syncing repository: workspace/this-repo > Getting Git version info > Copying 'C:\Users\runneradmin\.gitconfig' to 'D:\a\_temp\f6554cfe-9833-4920-999d-5ed3c171452b\.gitconfig' > Temporarily overriding HOME='D:\a\_temp\f6554cfe-9833-4920-999d-5ed3c171452b' before making global git config changes > Adding repository directory to the temporary git global config as a safe directory > "C:\Program Files\Git\bin\git.exe" config --global --add safe.directory D:\a\this-repo\this-repo > Deleting the contents of 'D:\a\this-repo\this-repo' > Initializing the repository > Disabling automatic garbage collection > "C:\Program Files\Git\bin\git.exe" config --local gc.auto 0 > Setting up auth > Fetching the repository > Determining the checkout info > Checking out the ref > Setting up auth for fetching submodules > Fetching submodules > "C:\Program Files\Git\bin\git.exe" submodule sync > "C:\Program Files\Git\bin\git.exe" -c protocol.version=2 submodule update --init --force --depth=1 > Submodule 'tests/private-repo' (https://github.com/workspace/private-repo.git) registered for path 'tests/private-repo' > Cloning into 'D:/a/this-repo/this-repo/tests/private-repo'... > ssh: Could not resolve hostname key-97c23a776206be62d055b3c8c9b8a91b0da7e1aa77e4bb609aaec6076a5583e2.github.com: Name or service not known > Error: fatal: Could not read from remote repository. > > Please make sure you have the correct access rights > and the repository exists. > Error: fatal: clone of 'https://github.com/workspace/private-repo.git' into submodule path 'D:/a/this-repo/this-repo/tests/private-repo' failed > Failed to clone 'tests/private-repo'. Retry scheduled > Cloning into 'D:/a/this-repo/this-repo/tests/private-repo'... > ssh: Could not resolve hostname key-97c23a776206be62d055b3c8c9b8a91b0da7e1aa77e4bb609aaec6076a5583e2.github.com: Name or service not known > Error: fatal: Could not read from remote repository. > > Please make sure you have the correct access rights > and the repository exists. > Error: fatal: clone of 'https://github.com/workspace/private-repo.git' into submodule path 'D:/a/this-repo/this-repo/tests/private-repo' failed > Failed to clone 'tests/private-repo' a second time, aborting > Error: The process 'C:\Program Files\Git\bin\git.exe' failed with exit code 1My workflow file (with some bits redacted):
I also want to note I really like this tool! I am not entirely sure how well Windows is supported and if this should work at all.
Thanks.