github cli 多个账户

问题描述

我正在尝试使用 GitHub CLI

到目前为止,我可以用它来列出我们公司 repo 中的 PR。

问题是当我尝试通过 gh pr checkout 123 结帐 PR 时,其中 123 是 PR 编号。

当我这样做时,我收到此错误:

[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
exit status 128

显示错误是因为它正在尝试使用 [email protected]。但我不使用 [email protected],因为我在 GitHub 上有多个帐户。所以我已经将我的 .ssh/config 设置为:

Host github.com-companyA
    HostName github.com
    User git
    IdentityFile ~/.ssh/companyA

Host github.com-companyB
    HostName github.com
    User git
    IdentityFile ~/.ssh/companyB

我认为解决方案是将 [email protected] 修改为 [email protected]:foo/bar.git

但我不知道在哪里可以使用 GitHub CLI 修改它。

我的最终目标是检查 PR,在我的本地机器上运行一些测试,然后标记 PR 为通过或失败。

我可以毫无问题地使用 git 处理项目。我可以推拉就好了。只是我想自动检出 GitHub 上 PR 的分支。我无法控制我的团队为他们的分支机构命名。

附注 我工作的公司使用不同的技术,而且两家公司每天都有多个 PR。 我只是想要一种自动测试多个 PR 的方法,这样我就不必一个一个地进行。 两家公司也在使用 GitHub Actions

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)