【发布时间】:2021-09-29 21:11:07
【问题描述】:
我想在 GitHub Actions 作业中 pip install 来自私有 GitHub 存储库的库。我可以将它安装在我的计算机上,因为我已将 GitHub 配置为接受 SSH 密钥。但是如何将 SSH 密钥提供给 GitHub Actions 运行程序?
在我的电脑上,这工作正常:
python -m pip install "git+ssh://git@github.com/ORG/LIBRARY.git@main#egg=SOMETHING&subdirectory=SOMETHING"
Collecting LIBRARY
Cloning ssh://****@github.com/ORG/LIBRARY.git (to revision main) to /tmp/pip-install-_kw52ce5/LIBRARY_35c4fb5cf6a64e30914beaec4a768bd1
Installing build dependencies ... done
...
Successfully built LIBRARY-0.1.1
出于隐私考虑,我更改了图书馆、组织和目录的名称。来自 GitHub 存储库的 pip 安装文档是 here。
我尝试了this 指南和this GitHub 操作,但没有成功。在 GitHub Actions 中,我收到以下错误消息:
Step 15/20 : RUN pip install -r requirements.txt
---> Running in 5ece3eb6572e
Collecting LIBRARY@ git+ssh://git@github.com/ORG/LIBRARY.git@main#egg=SOMETHING&subdirectory=SOMETHING
Cloning ssh://****@github.com/ORG/LIBRARY.git (to revision main) to /tmp/pip-install-ohx86p2h/LIBRARY_2972ab1296ce45afa73bbb3c5a036bd1
Running command git clone -q 'ssh://****@github.com/ORG/LIBRARY.git' /tmp/pip-install-ohx86p2h/LIBRARY_2972ab1296ce45afa73bbb3c5a036bd1
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
如何将 SSH 密钥提供给 GitHub Actions 运行器?
【问题讨论】:
-
不是一个完整的解决方案,但如果您有您的跑步者的公共 SSH 密钥(在指定的用户帐户上),您是否考虑将其添加到您的 GitHub 帐户的 SSH 密钥中?
-
是的,我将公共 SSH 密钥设置为我尝试从
pip install发送的存储库上的部署密钥。
标签: github ssh pip github-actions ssh-keys