github twitter linkedin
Unison on Windows with SSH public keys
2017-10-27

I used Nextcloud for a dropbox alternative, but last week it decided to fuck up and mark all my files as conflicted. Since then I don’t trust it with my data anymore and went to look for alternatives. I stumbled upon unison, which looks very good and is blazingly fast. To get it to run on Linux was no problem, but there are some hurdles on Windows.

In this post I will show what you have to do in order to get unison to run on Windows and use SSH public key authentication.

First, install Git for Windows. That’s the easiest solution I have found to get a working ssh command on your Windows machine. In the setup there is a screen which asks how you want to invoke Git, either from the Git Bash or from the Windows command line.

Git configuration

In that screen, choose the option on the bottom! Only that way the ssh command is runnable from a Windows command line. If you choose one of the top options, you can’t use unison from the Windows command line, only from the Git Bash. If that’s not a problem for you, you can just accept the default option.

ssh should now be working from your command line. Copy your private key in OpenSSH format (starts with -----BEGIN RSA PRIVATE KEY-----) to <user-home>\.ssh, for example to C:\Users\Moe\.ssh\id_rsa. Now a ssh <your server> should work from the Windows command line.

It’s time to install Unison for Windows. You can download the binaries here. After unpacking the zip, rename unison 2.48.4 text to unison.exe and put them in some directory. Add that directory to your PATH variable.

After restarting your Windows command line, you should be able to run unison. By default unison loads the profiles from <user-home>\.unison, for example C:\Users\Moe\.unison. Just put your profile in there (or overwrite the default.prf).

Happy syncing!


Back to posts