Skip to content

Instantly share code, notes, and snippets.

Last active Oct 11, 2017
What would you like to do?
Configuring PyCharm & Babun to work with SSH keys in Keepass using the KeeAgent Plugin

Configuring PyCharm, Babun & WinSCP to work with SSH keys in Keepass using the KeeAgent Plugin


This is a small guide on how to set up PyCharm, Babun & WinSCP on Windows to use SSH Keys which are saved in KeePass. This significantly improves the user experience while keeping the keys save.


Configure KeeAgent

  1. Start KeePass
  2. Tools -> Options -> KeeAgent
  3. Activate "Create Cygwin compatible socket file" and set path to a file like C:\Users\<USERNAME>\keeagent_cygwin.socket
  4. Add SSH keys to an entry in KeePass. You can just add them as attachments and then activate them in the tab "KeeAgent".

Make sure the correct environment variable is set for the user (this was the tricky bit to find out...)

  1. Start CMD shell
  2. Run: setx SSH_AUTH_SOCK "C:\Users\<USERNAME>\keeagent_cygwin.socket"
  3. Reboot! (Variable seems to not be imported into Babun/Cygwin otherwise)

Configure Babun

  1. Start Babun
  2. Make sure KeePass is started and unlocked.
  3. SSH to a host that has your key. It should automatically use your key.

Configure PyCharm

  1. Start PyCharm
  2. Go to Settings -> Version Control -> Git: Path to Git executable: C:\Users\<USERNAME>\.babun\cygwin\bin\git.exe SSH executable: Native
  3. Try out to clone a Git project or update one

Configure WinSCP

WinSCP should work out of the box. Enter the server name, port and user name and connect to a server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment