Skip to content

Instantly share code, notes, and snippets.

@duebbert
Last active October 11, 2017 13:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duebbert/1cd30115cf8ade37aa5b619080154e85 to your computer and use it in GitHub Desktop.
Save duebbert/1cd30115cf8ade37aa5b619080154e85 to your computer and use it in GitHub Desktop.
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

Description

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.

Installation

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