Recently, I wanted to give Fedora (KDE flavour) a try, so I installed it on a new disk. After copying all dotfiles (including SSH keys and Git configuration1), turning on saving SSH keys passwords to KWallet (and unblocking it on login) and checking if everything works - and it worked flawlessly2 - I turned off the PC.

The next day, as soon as I wanted to push the changes to the project, I was greeted by an unexpected pop-up:

Intellij popup to enter SSH key passphrase for ~/.ssh/id_rsa

The what? I have checked git from the console - everything is working as expected. So what happened? Turns out that IntelliJ (along with running git) expects the key to be loaded, but it is not. And it cannot load it without providing a password - it does not use the ‘ask pass’ tool (in my case - ksshaskpass).

So I decided to fix it in the simplest way ever - by adding a small script to autostart that will add keys that I expect to be loaded. Adding them works without providing passwords, as those are provided by KWallet and ksshaskpass.

To do so, I did the following - first, I created a directory to store all my ‘autostart scripts’:

# Create .run directory
mkdir -p ~/.run/

Then I have created the script add-ssh-keys.sh in .run using following snippet3:

# Add create add-ssh-keys.sh to add ssh keys
cat << EOF > ~/.run/add-ssh-keys.sh
#!/bin/sh
SSH_ASKPASS=/usr/bin/ksshaskpass
ssh-add ~/.ssh/id_ed25519 </dev/null 2>/dev/null || true
EOF

By default, it adds only the .ssh/id_ed25519 key, but it can have more lines - just add another ssh-add ~/.ssh/file_with_private_key.

To make sure that it will be runnable, let’s make it executable:

chmod +x ~/.run/add-ssh-keys.sh

After creating the script using the code above, I can add it to autostart using Settings → Autostart (using ‘Login Script…’ option):

KDE Settings - Autostart with opened menu to Add New

And that is all. After the login, the SSH keys that I want to be available are added (and passwords are fetched from KWallet) to the SSH agent. Thanks to that, IntelliJ is not asking me for a password anymore!


  1. My Git configuration uses subfolders to select proper emails and user names - all described in one of the previous posts ↩︎

  2. I’m quite amazed how nice it looks and how smoothly Fedora KDE works! ↩︎

  3. Snipped uses cat << EOF > file that allows putting multiline data into a file - all content until EOF is put into the file. Which is nice. ↩︎