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.
- Start KeePass
Tools -> Options -> KeeAgent
- Activate "Create Cygwin compatible socket file" and set path to a file
like
C:\Users\<USERNAME>\keeagent_cygwin.socket
- 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...)
- Start CMD shell
- Run:
setx SSH_AUTH_SOCK "C:\Users\<USERNAME>\keeagent_cygwin.socket"
- Reboot! (Variable seems to not be imported into Babun/Cygwin otherwise)
- Start Babun
- Make sure KeePass is started and unlocked.
- SSH to a host that has your key. It should automatically use your key.
- Start PyCharm
- Go to
Settings -> Version Control -> Git
: Path to Git executable:C:\Users\<USERNAME>\.babun\cygwin\bin\git.exe
SSH executable: Native - Try out to clone a Git project or update one
WinSCP should work out of the box. Enter the server name, port and user name and connect to a server.