This seems to work for using a private key when sharing a .ssh\config between MacOS and Windows.
In the config:
# Windows-specific configuration
Match exec "cmd /c if defined OS (exit 0) else (exit 1)"
IdentityFile C:/Users/myuser/OneDrive/Documents/.ssh/id_ed25519
# macOS/Linux-specific configuration
Match exec "cmd /c if defined OS (exit 1) else (exit 0)"