MSYS2 SSH:无效的密钥格式(仅在GitHub CI下)

发布于 2025-01-24 15:25:13 字数 1536 浏览 0 评论 0 原文

我是克隆 repob repoa ,使用 repob 的部署密钥(存储在 repoa 中)。我了解这可能不是一个好习惯,无需对此发表评论(谢谢)。

工作流程 > ubuntu-20.04 ,并在 Windows-latest 上使用msys2。它可以在Ubuntu上使用,我可以在常规MSYS2安装上手动运行命令,但是它。 CI日志具有所有详细信息,必要的命令是

git -c core.sshCommand='ssh -vvv -i repoB_deployment_key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' clone -b main [email protected]:eudoxos/repoB.git repoB

Windows下的故障为 加载密钥“ repob_deployment_key”:无效格式 ,我无法找出出了什么问题。我尝试更改专用密钥的权限( chmod 600 ),添加 -o usernownhostSfile =/dev/null -o stricthostkeychecking = no ,通过 unix2dos 运行键,添加额外的尾随newline - 没有任何帮助。

同样,同一命令在ubuntu下和桌面窗口上的msys2下工作。

存储库是可以公开读到的;欢迎您打开 repoa 存储库的PR;公关应触发CI运行。

I am cloning repoB within GitHub CI workflow of repoA, using deployment key of repoB (stored in repoA). I understand this might not be a good practice, no need to comment on that (thanks).

The workflow tests this procedure natively on ubuntu-20.04 and using MSYS2 on windows-latest. It works on Ubuntu, I can run the commands manually on regular MSYS2 installation, but it fails on GitHub CI. The CI log has all the details, the essential command being

git -c core.sshCommand='ssh -vvv -i repoB_deployment_key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' clone -b main [email protected]:eudoxos/repoB.git repoB

The failure under Windows is Load key "repoB_deployment_key": invalid format and I am not able to find out what's wrong. I tried changing permissions for the private key (chmod 600), adding the -o UserKnownHostsFile=/dev/null and -o StrictHostKeyChecking=no, running the key through unix2dos, adding extra trailing newline — nothing helped.

Again, the same command works under Ubuntu and under MSYS2 on desktop Windows.

The repos are publicly accessible fro reading; you are welcome to open a PR to the repoA repository; a PR should trigger the CI run.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

贪恋 2025-01-31 15:25:13

通过dos2unix(不是 unix2dos)运行钥匙解决了问题。我将将其作为MSYS2的问题提交,因为应该记录下来。

Running the key through dos2unix (not unix2dos) fixed the issue. I will file that as an issue with msys2, as this should be documented.

|煩躁 2025-01-31 15:25:13

在您的github工作流中尝试首先显示密钥,以便在视觉上检查其内容和格式(如在这里看到

还要检查创建键时使用的ssh c:\ program files \ openssh-win64 一个,或Windows git的一个( c:\ program Files \ git \ usr \ usr \ bin \ ssh.exe )。

Try in your GitHub workflow to display the key first, in order to visually check its content and its format (as seen here)

Check also which SSH you used when creating the key, the c:\Program Files\OpenSSH-Win64 one, or the one with Git for Windows (c:\Program Files\git\usr\bin\ssh.exe).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文