How do I connect IntelliJ to GitHub using SSH

前端 未结 5 1991
后悔当初
后悔当初 2020-12-28 16:25

I have successfully configured my GitHub client to use SSH, and received the confirmatory email from GitHub that a new SSH key was added. I would like to setup IntelliJ to u

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-28 16:57

    GitHub plugin for IntelliJ lets you to save the password, so you don't have to enter it every time.

    enter image description here


    With keys

    (adapted from Multiple SSH Keys settings for different github account, thanks to CrazyCoder comment):

    • Create ssh key pair

      $ ssh-keygen -t rsa -C "activehacker@youremail.com"
      
    • Add key

      $ ~/.ssh/id_rsa_activehacker
      
    • Confirm that the key is added

      $ ssh-add -l
      
    • Modify ~/.ssh/config

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


    In IntelliJ

    VCS > Checkout from Version Control > Git

    Checkout from Version Control

    Test

    Test

    As you can see, you will still have to either enter passphrase for the key pair after every IntelliJ relaunch(I believe the passphrase is kept in memory) or let IntelliJ to store it permanently.

提交回复
热议问题