9

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

3 Answers 3

19

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

Sign up to request clarification or add additional context in comments.

3 Comments

Conversion with ssh-keygen: cp oldprvkeyfile newprvkeyfile; ssh-keygen -p -m PEM -f newprvkeyfile
@LorinczyZsigmond Good addition!
For anyone using ssh-ed25519... I didn't find a way to convert. Generate a new RSA(!) key with the old format was the only thing working for me: ssh-keygen -t rsa -C "<name>" -b 4096 -m "PEM"
9

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)

Comments

4

Settings repository does work with the SSH keys.

Make sure you specify the URL correctly, as [email protected]:username/Repo.git If your ssh keys are not called id_rsa/id_rsa.pub, make sure they are correctly referenced in the .ssh/config

Also, the error might occur because for some reasons IDE cannot overwrite local config files. Check the IDE logs for any related errors.

4 Comments

IS there anything else I need to do? add the id_rsa to ssh agent is also what I did but it still doesn't work.
No, there is no any specific config. Just make sure IDE recognizes the agent - restart it if you started the agent while IDE was running.
How is that IDE connected to the ssh agent? Restart which one? The agent? OR the ide? I'm just trying to make sense of all of this.
As any other app, IDE interacts with ssh-agent only when the SSH_AUTH_SOCK env variable is set. And as in any other app, env variables are loaded on start. So first start Agent, then IDE, not otherwise.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.