GitHub Pull Request integration and SSH aliases

已回答

Dear IntelliJ community,

I just stumbled upon a limitation of the GitHub plugin: it does not recognize SSH host aliases.

I have 2 SSH host aliases in my ~/.ssh/config file. Both point to hostname github.com, but they use different SSH keys - one is linked to my personal account, and the other one to my professional account. E.g, I might have something like this:

Host personal-github.com
  HostName github.com
  User git
  IdentityFile /home/user/.ssh/github_personal_rsa
Host pro-github.com
  HostName github.com
  User git
  IdentityFile /home/user/.ssh/github_pro_rsa

This way, if I clone a repository with URL git@pro-github.com:org/repo.git, I have access to my employer's private repositories; and with git@personal-github.com:user/repo.git, I have access to my private repositories instead.

Unfortunately, this breaks GitHub integration in IntelliJ IDEA, since it seems to rely upon the remote's URL being in the form git@github.com:org/repo.git - meaning that when I clone a repository with one of the above defined aliases, I don't get the "Pull Requests" tool window, but it appears correctly when I clone the repository with the git@github.com URL instead.

Would it be feasible for the GitHub integration to recognize such use of SSH aliases? I believe this could be used to auto-detect which GitHub account to use, when applicable.

4

请先登录再写评论。