Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Settings Repository using ssh authentication

I'm trying to use the Settings Repository feature in Intellij 2017.1 but I want to use an ssh url for the repo instead of https. I don't like to deal with those personal access tokens that then you can't copy after they get created for the first time. So i'm trying to use ssh but when I click "Override Local", I get the following error

Failed to set upstream repository: Read-only file system

Am I forced to use https or there's a way to configure it to work with ssh? my ssh key works fine in the terminal to push and it is in the normal location ~/.ssh

like image 760
Hilikus Avatar asked May 13 '17 04:05

Hilikus


2 Answers

This answer possibly doesn't solve your issue but I'll still add it because this page was a first result in Google by "intellij settings repository auth fail" request.

I had an issue with "Auth fail" error when adding settings repository. I faced it after upgrade to macOS Mojave 10.14.1 which provides new version of ssh-keygen binary.

The cause was a new ssh key which I generated with ssh-keygen -t rsa -C "Michael Ledin" -b 4096 command.

Check your private SSH key (usually ~/.ssh/id_rsa). If it starts with

-----BEGIN OPENSSH PRIVATE KEY-----

then it has new RFC4716 key format which is currently not supported by JGit used by IntelliJ based IDEs.

To solve this issue you can:

  1. either generate new key in old "PEM" format, add -m "PEM" option:

    ssh-keygen -t rsa -C "Michael Ledin" -b 4096 -m "PEM"
    
  2. or if you already added your public key to ssh remotes and repositories and it's hard to replace it with new key everywhere, then you have two options to convert it to old PEM format:

    a) with ssh-keygen (it will ask for a new passphrase - use the old one or leave it empty):

    ssh-keygen -p -m PEM -f ~/.ssh/id_rsa
    

    b) with putty

    1. first install putty and convert private key to SSH2 format (I presume that your current key is stored at ~/.ssh/id_rsa):

      brew install putty
      mv ~/.ssh/id_rsa ~/.ssh/id_openssh
      puttygen ~/.ssh/id_openssh -O private-sshcom -o ~/.ssh/id_ssh2     
      
    2. next convert SSH2 key to PEM:

      ssh-keygen -i -f ~/.ssh/id_ssh2 > ~/.ssh/id_rsa
      rm ~/.ssh/id_ssh2
      
    3. now you have your private key ~/.ssh/id_rsa in old PEM format that can be used by IntelliJ based IDEs; the original key is stored in ~/.ssh/id_openssh file and can be removed:

       rm ~/.ssh/id_openssh
      

Links that were used to create this answer:

Convert OpenSSH private keys to RSA PEM

ssh-keygen does not create RSA private key

like image 192
mixel Avatar answered Nov 06 '22 04:11

mixel


Does not and cannot work for certain SSH setups

The "Settings Repository" support for ssh is limited to the Java jgit implementation. Whereas you can configure new and existing projects to use your OS native ssh, this preference is ignored by the "Settings Repository" feature.

As such any jgit limitations which prevent it from working with your SSH setup will prevent the "Settings Repository" feature from working with no possible workaround.

Settings repository is a separate feature based on the JGit, and it is not related to the Version control - Git, that is why changing settings there has no effect.

Settings repository does not have a Native SSH mode and does not benefit from the ssh-agent.

Dmitriy Smirnov (JetBrains) — Settings Repository feature always asks for SSH key password even though key is in my SSH agent already

I downloaded and was in the process of setting up IntelliJ on a new machine when I ran into problems trying to overwrite my local settings from a settings repository. It seems like it is a problem with how Git is used internally by the settings repository. Below are examples of trying to use the Settings Repository feature and also Clone Repository with both Built-in and Native SSH. I'm not sure how to get this working correctly now.

Vladimir Krivosheev — Settings repository - add Native SSH mode (IDEA-173223)

like image 24
toolbear Avatar answered Nov 06 '22 05:11

toolbear