IntelliJ - 如何使用不同的 ssh 密钥
我有 2 个 github 帐户 公司一台和个人一台
我使用 cygwin 来管理我的 ssh 密钥并连接到 Github
在使用公司帐户时在 IntelliJ 中一切正常,因为它使用默认的 .ssh/id_rsa 密钥
使用我的个人帐户在 Cygwin 中一切正常我可以使用“ssh-add ~/.ssh/ide_rsa_otherkeyfile”命令,然后通过命令行使用所有 git 命令
但 IntelliJ 始终默认为“id_rsa”文件所以我无法连接到我的个人仓库。
IntelliJ 有没有办法使用其他 rsa 密钥?
所有这些 RSA 和 cygwin 都远远高于我的 Linux 命令行经验水平。
笔记: 我还在 .ssh 目录中创建了配置文件,以方便多个 github 帐户
Default GitHub user (corporate account)
Host github.com HostName
github.com User git IdentityFile/Users/username/.ssh/id_rsa
Client user (personal account)
Host github-client
HostName github.com
User git IdentityFile /Users/username/.ssh/id_rsa_perso
简而言之,它的作用是告诉 SSH 在连接到服务器 github-client(实际上是 github.com)时使用客户端密钥。 >
如果没有人有解决方案,我知道邀请我的公司帐户作为贡献者会更容易,但随后我将在 2 个单独的电子邮件帐户下进行提交。
I have 2 github accounts
A company one and a personal one
I use cygwin to manage my ssh keys and connect to Github
Everything works fine In IntelliJ when using the corporate account since it uses the the default .ssh/id_rsa key
Everthing works fine in Cygwin using my Personal Account since I can use the the "ssh-add ~/.ssh/ide_rsa_otherkeyfile" command and then use all git commands via command line
But IntelliJ always default to the "id_rsa" file so I can not connect to my personal repo.
Is there a way for IntelliJ to use the other rsa key?
All this RSA and cygwin is way above my linux command line experience level.
Note:
I also created the config file in .ssh directory to facilitate multiple github accounts
Default GitHub user (corporate account)
Host github.com HostName
github.com User git IdentityFile/Users/username/.ssh/id_rsa
Client user (personal account)
Host github-client
HostName github.com
User git IdentityFile /Users/username/.ssh/id_rsa_perso
In short what this does is tells SSH to use the client key when connecting to the server github-client, which is really github.com.
If no one has a solution I am aware that it would be easier to invite my corporate account as a contributor but then I woul have commits under 2 seperate email account.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从版本控制系统检出您的项目时,请使用
:/
格式为 VonC 提到。When checking out your project from Version Control System, use
<host-from-ssh-config>:<github-username>/<repository>
format as VonC mentioned.来自使用 Git 集成:
From Using Git integration: